ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Hi all,
I am get this error. " ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111) ".
How can ı solve this error?

Thanks.

@parttime, please check that MySQL is actually running. If MySQL is not running, restart it. If MySQL is running, then your tool is trying to connect to MySQL via socket that does not exist in that path. Log into MySQL via TCP/IP (ex: mysql -h 127.0.0.1) and check the location of the socket.

Mysql is not restart. How can ı this status?

Try,

systemctl restart mysql 
tail -50 /var/log/mysqld.log

What os and what version of mysql ?

@parttime,
Use systemd to restart MySQL sudo systemctl restart mysql

1 Like