Ubuntu – Mysqld.sock doesn’t exist

MySQLUbuntuubuntu-10.04

I have a MySQL server running on Amazon EC2 in a VPC instance. I had to change the instance type of it to handle load and when I brought it back up, the socket didn't exist anymore. The file /var/run/mysqld/mysqld.sock doesn't exist and nor does the directory.

I have no idea where it went, but it is just gone. So is there a way to fix that? If so how? The server is running Ubuntu 10.04.

Best Answer

Confirm that mysqld.sock doesn't exist

sudo find / -type s | grep mysqld.sock

Check that your /etc/mysql/my.cnf file agrees that the file should be /var/run/mysqld

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

and if it does then

sudo mkdir -p /var/run/mysqld
sudo chown mysql /var/run/mysqld/
sudo service mysql restart

but I suspect your problem lies elsewhere as the mysql start script will create the directory if it doesn't exist. Is there any relevant message in your mysql logs ?