Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql.sock is not created OSX

I run mysql on OSX, now when I restart my computer it does not create the mysql.sock, meaning that all my connections gives me a error 2002.

anyone knows how to prevent this?

like image 490
nivanka Avatar asked Jan 31 '11 02:01

nivanka


People also ask

Why mysql sock is missing?

mysqld. sock is created by the mysql daemon on start, and it is removed (or, becomes un-connectable) if this daemon stops. This message is given by some client process, trying to connect your mysqld on this socket without success. Its most likely reason is that the mysqld doesn't run.

Where is mysql sock OSX?

sock , but on my Mac (Mac OS X 10.5) the socket is really located at /private/tmp/mysql. sock .

Where is my mysql sock?

The MySQL server's socket file is named mysqld. sock and on Ubuntu systems it's usually stored in the /var/run/mysqld/ directory. This file is created by the MySQL service automatically.


1 Answers

I had this same issue on Snow Leopard, the socket spawns in the wrong location for some reason on OS X.

To get the socket spawning in the correct location: create a new file "my.cnf" in /etc with the following lines:

[mysqld]
socket=/var/mysql/mysql.sock

[client]
socket=/var/mysql/mysql.sock

and restart mysqld: sudo /usr/local/mysql/bin/mysqld_safe

This will force the MySQL socket file to spawn in the proper location, and everything should work normally. Good luck!

like image 181
DashRantic Avatar answered Sep 23 '22 04:09

DashRantic