Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Sep 7 '10 at 4:58

This question came from our site for professional and enthusiast programmers.

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?

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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