Reputation: 6068
I am getting the following error
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
How can i restore the mysql.sock file?
[Edit]
I am trying to connect to mysql database from my ROR application. It was working fine till yesterday. But today I found out the mysql.sock file was missing. I don't know the reason of what led to deletion of mysql.sock file from location /var/lib/mysql/. How can i restore the mysql.file?
Thanks.....
Upvotes: 2
Views: 3472
Reputation: 749
I had the same problem and after spending some time i got the solution. From your terminal run this command -- sudo apt-get install mysql-server
Upvotes: 0
Reputation: 141
here is a rude yet quick way to solve this, but if your data or operation is important, you'd better find an other way
kill all the mysql process
now your mysql should be stopped, but locked.
So delete the lock file and restart mysqld
rm /var/lock/subsys/mysqld
/etc/init.d/mysqld start
Upvotes: 1
Reputation: 17408
Try this:
$ mysql_config |grep -- --socket
It should show you the socket path as compiled in to the server. If that fails, try running the mysql
command and look for the socket path in the output of \s
.
Upvotes: 6