Q: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
A: from the sun knowledgebase
I've just install the "Qube3-All-Security-4.0.1-15959" and now it's impossible for me to connect to MySQL database through PHP. In phpMyAdmin, it tell me "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)". What can I do to fix this?
Answer
Typically MySQL puts it's socket in 1 of 2 places /var/lib/mysql or /tmpThe scripts, DB's etc expect the install to have it in /tmp but, because of no access, tmpwatch cleaned it up I've seen that before on servers that don't have much mysql usage.The fix is to verify that the socket really does exist in /var/lib/mysql & recreate the symlink (as root)
Syntax is link realfile fakefile.
For example:
ln -sf /var/lib/mysql/mysql.sock /tmp/mysql.sock