mysql 5.7

mysql is dead but subsys locked

MySQL is dead but subsys locked

Issue Description:

When tried to connect to MySQL or run any command.

It Displayed The Following Error:

Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'(2)

When checked the status of MySQL service from the below command:

service mysqld status

as a root user I got : mysql is dead but subsys locked

Here is the solution for the issue:

copy for safety :

cp /var/lock/subsys/mysqld /root/mysqld

than delete it

rm /var/lock/subsys/mysqld

then close all services that depend on MySQL:

service httpd stop

after that:

service mysqld restart

Then restart all the dependable services.