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:

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

Solution is very simple:

/etc/my.cnf

skip-innodb
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

Cheers.

If you want to reset MySQL root Password in Linux,You can check the simple steps here.