MySQL error : Can’t connect to local MySQL server through socket

Here is an error that can fall on you without crying guard:

Can not connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

From one moment to another moment, the database disappears for no apparent reason. This can be due to InnoDB which has to check that the tables are not broken and that has to then close MySQL.

You can verify the cause of the error by going to:

var / log / mysql / error.log

The problem can be solved with a simple:

Service mysql restart

If this does not work, you can try to kill the last mysql process:

Ps ax | Grep mysqld


kill -9 PID

Where PID is the first number from the left.

Otherwise, it may be necessary to reinstall the mysql server (not the mysql client):

apt-get install mysql-server

Or check the path to mysql:


Leave a Reply

Notify of