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
2. If the permissions are correct, the /tmp/mysql.sock may not be existing. If so do the following.
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/mysqlThen, 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 stopThen touch a file mysql.sock
#touch /tmp/mysql.sockThen start the mysql server.
#/etc/init.d/mysql startThis should fix the issue.....