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

You can leave a response, or trackback from your own site.

One Comment

  1. Juan says:

    In my Leopard there’s no such my.cnf file at all (I’ve looked for it with Textwrangler)

Leave a Reply

Collaborate.
Enable.
Succeed.

Contact

(888) 331-8520
4210 Beau James Court
Winter Park, Florida 32792 RSS Feed

Search

Popular Articles

Recent Articles