Saturday, November 30, 2013

Can't connect to MySQL server on 'localhost' (10061)


Installed MySQL on Windows 2008 and could not connect to database running on local host via command line.

Can't connect to MySQL server on 'localhost' (10061)

Turns out if you ping localhost you'll get an IPV6 response [::1] instead of IPV4 127.0.0.1 and mysql can't translate.

To fix map vp4 to vp6 using netsh:

netsh interface portproxy add v4tov6 listenport=3306 connectaddress=::1 connectport=3306


If you see this error:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

Make sure MySQL is running in your services list. If you did something dumb like I did and didn't install it as a service for some unknown reason, you can add it to your services list using the following:

"C:\Program Files\MySQL\MySQL Server x.x\bin\mysqld" --install