Sunday, March 16, 2008

why do i get this mysql error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 0

You should check that mysqld is running first of all. If it is, check to see that it's looking for the correct UNIX socket.

On FreeBSD it would look something like this :
# netstat -f unix grep mysql
x65b33c0 stream 0 0 e5477840 0 0 0 /tmp/mysql.sock

On Linux is would look something like :
# netstat -ax grep mysql
unix 2 [ ACC ] STREAM LISTENING 362783486 /var/lib/mysql/mysql.sock

If you have one and an application is looking for the other, make a symbolic link (ln -s) from the one you see to the one it wants.

No comments: