Mohamed Gharib
Mohamed Gharib

Reputation: 2587

Wamp mysql : ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

I installed wampserver on my xp machine month ago.. Now when I try to connect to mysql via phpmyadmin or mysql console I get the error :

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

Wamp icon in the tray is green meaning it's running ok.. I checked for mysql service and it's running and using the port 3306 .. I turned off the firewall.. I tried everything and it's not working.. I eventually uninstalled wamp totally and removed all its files and re-installed it again and same error.. When I try to telnet localhost 3306 it doesn't connect and I get the error :

Could not open connection to the host on port 3306: connect failed

I searched the web for hours, but didn't find any working solution. It seems that many people are having the same problem and most of them didn't find the solution.

Upvotes: 1

Views: 6749

Answers (3)

Tedjy
Tedjy

Reputation: 1

I also did some research on my side I reconfigure the sql parameters then in the type and networking section you have to uncheck the open windows button Firewall ports for network access then you have to press next until closing without anything modify other

enter image description here

Upvotes: 0

Bernd Posena
Bernd Posena

Reputation: 1

In my.ini there is - for example -the entry

    # Secure File Priv.
    secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads"

If this path is not (further) existing, mysql cannot be started. You have then to put an existing path.

Upvotes: 0

Mohamed Gharib
Mohamed Gharib

Reputation: 2587

Ok .. searching the internet for more several hours I've found one little clue that actually fixed my problem.

When I type netstat -a I get a list of active ports including 3306 (the one mysql uses). The Foreign Address column for some ports is 0.0.0.0.0 but for 3306 is [::]:0. I'm not a network guy but it turned out that it means it's a IPv6 port and it should be IPv4.

Adding the following line in the file my.ini under [mysqld] and restarting the service solved the problem.

bind-address=127.0.0.1

Note

  • My wamp version is 2.4 and mysql version is 5.6.12 running under win XP.

  • my.ini file for me is located at c:\wamp\bin\mysql\mysql5.6.12.

Hope this helps who suffered my pain.

Upvotes: 3

Related Questions