MySQL – Where is mysql.sock?

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?


Slackware 12.1

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.

Download here


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.

Cya brothers..


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Up ↑

%d bloggers like this: