After recently reinstalling MySQL 5 on my OSX Leopard machine Rails stopped being able to connect to it – every time I’d start script/server it would say:
Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
After spending some time looking to see if maybe the socket file had been put in a different location I finally found the issue: MySQL wasn’t creating a socket file at all and needed to be told to do so. So, if you start receiving the above error, just make sure that the file /etc/my.cnf has the two socket lines as mentioned below, one in the [mysqld] section, the other in the [client] section:
[mysqld] bind-address = 127.0.0.1 socket=/tmp/mysql.sock [client] socket=/tmp/mysql.sock
Other Posts That Might Interest You




