A long time I didn’t post about some problem, but today I had a problem with MySQL and I guess that many people had same problem.
I’d like share with yours. When I try to login in the terminal MySQL reply me:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysql/mysql.sock’ (2)
What’s a hell?
Mysql Server version: 5.0.51b
MySQL sever when it’s (mysqld) starts, it created a sock file.
Ok. but where is the problem?
So, when We tried to start the mysql client(#mysql -u root) it looking for mysql.sock but could not
find the path to the file.
The cause of the error is because the mysql client can’t find the socket file at runtime.
Necessary create the file mysql.sock. But before please you should verify that mysqld is running:
#ps aux | grep [m]ysqld
Ok. I wrote simple path for mysql.
Check #ls /var/run/mysql
Sure, it`s created mysql.sock. Now running:
I hope this help you all. Case you know other suggestion is welcome.