Sunday, July 21, 2013

Can’t connect to MySQL [local] server

Are you frustrated trying to connect to MySQL? Well, I was, when I updated MySQL server from 5.1 to 5.6 couple of days ago. Updating was easy and MySQL service started without hitch but when i try to connect using MySQL administrator or Workbench or plain vanilla MySQL command-line, nothing worked. I got error after errors:

“d:\mysql\bin>mysql
ERROR 2013 (HY000): Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0

In Window Event Viewer:

Error in accept: No error

After hours of going through logs  and configuration files (my.ini & my.cnf), nothing helped. I gave up. Next day, with fresh mind, I did some googling and reading MySQL manual ( Server System Variables), i figure out i don’t have bind-address in my config file (my.ini). I tried adding

bind-address=127.0.0.1 to  my.ini file

[mysqld]
user = mysql
port = 3306
bind-address = 127.0.0.1

Restart the mysql service

And It WORKED!

No comments: