MySQL error : Can’t connect to local MySQL server through socket
Here is an error that can came out of the blue at you. This error often happens when you make a major modification on your server, when you move your data to a new server, when you try to install a new SSL certificate, etc.
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
Then:
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:
/etc/mysql/my.cnf
Note: Commissions may be earned from the links above.
This page contains references to products from one or more of our advertisers. We may receive compensation when you click on links to those products. For an explanation of our advertising policy, please visit this page.