We recently updated the MySQL database server we use on this site from MySQL 4.1 to 5.0. The server uses Cpanel or WHM to manage the various websites hosted on the server. The server was having several issues with the existing installation of MySQL and since we needed to reinstall MySQL already; an upgrade was also performed. During the upgrade only one issue occurred resulting in the error "ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)". The solution to this came out of quite a bit of trial and error, however the simple solution involved removing the file or changing the my.cnf file name and reinstalling MySQL.
For simplicity, run the following commands and the error should go away:
Move the old my.cnf file to another filename: mv /etc/my.cnf /etc/my.cnf.OLD
Force MySQL to update: /scripts/mysqlup --force