ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

chris (2006-11-21 10:10:10)
2040 views
0 replies
Fixing this error: " ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) " - I'm pretty sure this is about the most common error encountered by DBA's trying to connect to new mysql installations. There are two likely causes for this problem - One is simply a permissions issue. The other is a missing mysql.sock file.

To fix the first, just ensure that you run chown -R mysql.mysql /var/lib/mysql

To fix the second situation, you will need to locate your mysql.sock using
$updatedb && locate mysql.sock 

And you will then need to create a symbolic link from /var/run/mysql/mysql.sock to /tmp/mysql.sock, (or whatever the path to mysql.sock is)

christo
comment