Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
This post is CENT OS based:
You got this error:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
Simple troubleshoot:
- Goto
/var/lib/mysql/
(or locate mysql.sock othervise) - Delete
mysql.sock
- Restart mysql via
service mysqld restart
PS. Don’t forget to updatedb
to get the locate
most accurate.
If you cannot find the socket path /var/lib/mysql/</code>mysql.sock
get the path from this command:
vi `locate my.cnf | awk '{if (1==NR) print $0}'`
…
tags: & category: -