Wednesday, May 30, 2012

Could not connect: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) solution :


Could not connect: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
solution :

We get this error if mysql.sock file is not available at /var/lib/mysql
login to server
killall -9 mysqld

service mysql start

service mysql restart

If still mysql.sock is not created under /var/lib/mysql then,
Go to /tmp
We will found there mysql.sock in red color
Delete it from /tmp
Service mysql restart
This should create mysql.sock file at /var/lib/mysql
OR

Use command “ln -s /var/lib/mysql/mysql.sock mysql.sock” to create it
then restart mysql and check

No comments:

Post a Comment