MySQL Connect error (2) with suPHP on CloudLinux

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/user/public_html/index.php on line 3

Possible Fix #1

The issue could be caused by cagefs. Make sure the path /var/lib/mysql exists on it's own line inside the /etc/cagefs/cagefs.mp file. Next, run cagefsctl --remount-all and see if the issue is resolved.