Tags

Hi everyone,

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:

bash-3.1# mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysql/mysql.sock’ (2)

What’s a hell?

System

Slackware 12.1

Mysql Server version: 5.0.51b

Problem

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.

Solution

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.

Download here

Running
#./pathMsql.sh

Check #ls /var/run/mysql
mysql.sock

Sure, it`s created mysql.sock. Now running:

#mysql
mysql>

Conclusion

I hope this help you all. Case you know other suggestion is welcome.

Cya brothers..

Razec

Advertisements