Wednesday 31 July 2013

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

If you end-up with the error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2), it means 2 things.

1. You don't have permissions to access the directory /var/lib/mysql/. Check the permission there and change the ownership mysql if it is not. For that do the following
#chown -R mysql.mysql /var/lib/mysql
Then, restart mysql
#/etc/init.d/mysql restart

2. If the permissions are correct, the /tmp/mysql.sock may not be existing. If so do the following.
#/etc/init.d/mysql stop
Then touch a file mysql.sock
#touch /tmp/mysql.sock
Then start the mysql server.
#/etc/init.d/mysql start
 This should fix the issue.....



No comments:

Post a Comment