Our mysql service went offline earlier and when we attempted to restart it we were presented with the following error:

System error 2: No such file or directory ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

We checked the mysql config and it is looking in: datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock

but our mysql.sock file is no longer present in /var/lib/mysql/

We tried 'whereis mysql.sock' and it returned: mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

Several help guides suggested running: ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

but /temp/ is empty.

Does anyone know how we might repair this problem please?


How are you starting it? On CentOS the init script will delete the socket file on stop. When MySQL is started via the same script the socketfile will be created. Perhaps you're attempting to start it manually and forgetting the --socketfile option?


I got the same problem with aix. I had to kill the running mysql (with sigterm, not sigkill), ensure that there wasn't sock files arround, and start it instead of restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.