Monday, September 21, 2009

ERROR 2003: Can't connect to MySQL server (10060)

ERROR 2003: Can't connect to MySQL server (10060)

Well, finally I rectified this error after doing google and research for 3.5 Hours.

I installed mysql database on my machine and I was trying to access it from the remote machine using MySQL query browser. But it was giving the error. If you are also facing the same problem then here are couple of things you can try.

  • If you have antivirus/firewall installed then make sure that it is not blocking traffic for port 3306(default port for mysql).

  • I have installed/configured MySQL to run as a service in windows box. If you have the same configuration, then open the Computer Management by Manage.

    Go to Service under Services And Applicaton.

    Look for mysql service and double click it to check the properties.

    The executable path should be like this: "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt" --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" MySQL

    Now it uses "my.ini" file for the configuration. Open this file on text editor. Under [mysqld] section add following line:

    bind-address=0.0.0.0

    You can give any ip address, if you want to listen only to localhost then you can give 127.0.0.1. The above configuration will listen to all ip addresses.

    If you are on linux machine, then you have to edit /etc/mysql/my.cnf file.


Hope this helps !!!
Enjoy !! :)