Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) [2002]

Sometime get the following error on MySQL sites and also when trying to access MySQL from server:
[wpfmb type=’error’ theme=2]Can’t connect to local MySQL server through socket‘/var/lib/mysql/mysql.sock’ (2) [2002][/wpfmb]
Solution is very simple:


Try to restart MySQL and if it don’t start then use:

killall -9 mysqld

Assign appropriate permissions to your /tmp directory.

# chmod 1777 /tmp

After that restart MySQL:

service mysql restart

[wpfmb type=’info’ theme=2]If you want to reset MySQL root Password in Linux,You can check the simple steps here.[/wpfmb]