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

I tried to migrate a 5 year old ruby on rails application onto a new server with Ubuntu 8.04, Apache 2 and MySQL 5.

The application failed to run. When I looked in the error logs, I noticed

Errno::ENOENT (No such file or directory - /var/run/mysqld/mysqld.sock)

I looked around my new server but can't find a mysqld.sock file. How can I fix this problem?

share|improve this question
up vote 1 down vote accepted

Most likely your MySQL service isn't running. The socket in your error is the default location for the MySQL socket in Ubuntu, so unless you compiled MySQL from source or changed the MySQL configuration it should be there.

Try to start MySQL:

sudo /etc/init.d/mysql start
share|improve this answer

You probably need to check whether: a) mysql is running b) sockets are enabled c) the default socket location is available

So here is how you would go about it: a) check mysql is running

sudo ps -ef | grep -c mysql

If the count returns 0 then mysql is not running. This check will also catch if mysql has been started with safe_mysqld.

If you don't think it is running then you can issue the standard init start script.

sudo /etc/init.d/mysql start

If you check again and the answer is 0 then mysql for some reason is not starting and you have bigger problem. A good place to start is to fire up mysqld from the command line using the bare bones binary call, if something is wrong it should be pushed out to standard error on the console.

b) if the server is running you can check if it has sockets enabled by either checking my.cnf config file or by using netstat

sudo netstat -nalp | grep mysql

This should let you know if sockets are available -> they can be in the state of either CONNECTED or LISTENING. If there are no LISTENING sockets available then it could be that your server is too darn busy to talk to you. But in general if the server is running you should at least have one LISTENING socket.

c) you should check in your my.cnf file to see where the socket location is - in case it does not match the default; and whether it is not commented out.

socket          = /var/run/mysqld/mysqld.sock


socket          = /var/run/mysqld/mysqld.sock
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.