Sep 012010
Can't connect to local MySQL server through socket
Answer:
Sometimes when you type the mysql command, it shows:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The cause of this problem is the MySQL socket file is not in the default location, e.g. /tmp/mysql.sock
To fix, edit the MySQL configurations, e.g. /etc/my.cnf, add the following lines
[client]
socket=/tmp/mysql.sock