MySQL, IPv6 and Socket Error on Localhost

Posted in Know-How on April 1st, 2011 – – Be the first to comment

Just upgrading MySQL to the newer version on Windows XP-SP3 machine for development purpose (localhost). Got me some trouble when open phpMyAdmin: “Socket error: MySQL server’s socket is not correctly configured”.

So I compared the newer my.ini file to the previous version, and found the socket value are different.

#on NEWER my.ini
socket= C:\server\mysql\mysql.sock


#on PREVIOUS my.ini
socket= "MySQL"

After change the socket value to “MySQL”, I can connect to MySQL from phpMyAdmin. But when I close internet connection, I got another error: “Could not connect to MySQL server on localhost”.

After some googling, I found that this came when we enable IPv6 on our OS. But well, I don’t want to disable IPv6 on my machine as some of users suggested. So I found “bind-address” directive will solve the problem.

If you have same problem, try the configuration below:

#my.ini configuration on IPv6 enabled machine
[client]
host = .
port= 3306
socket= "MySQL"
[mysqld]
port= 3306
bind-address=127.0.0.1
socket= "MySQL"


Leave a Reply