Posts Tagged ‘socket’

No such file or directory - /tmp/mysql.sock

Sunday, August 10th, 2008
No Gravatar

Today I started messing around with Rails again, after having spent the best part of the last months on Merb.

Anyway the common link problem for the mysql adapter reared its ugly head as usual.
No such file or directory - /tmp/mysql.sock

The solution to this is to create a symbolic link from your mysqld.sock to /tmp/mysql.sock

But where is your mysqld.sock?

For Mac OSX it is usually in /opt/local/var/run/mysql5/mysqld.sock.
Check where it is with locate.

locate mysqld.sock

Now create the symlink:
ln -s /link/to/where/mysqld.sock /tmp/mysql.sock
on my Mac, I ran:
ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock


nogeek.org is Digg proof thanks to caching by WP Super Cache!