Why do I get “MySQL is not running but lock exists”?

0 votes
asked Aug 8, 2009 by mysql-dba

I am getting this error

mysql is not running but lock exist

when I am checking the status of MySQL server. I have removed the lock files using following command:

rm /var/lock/subsys/mysql

but still I am getting same error.

Can anyone provide any input on this.

2 Answers

0 votes
answered Aug 8, 2009 by charles-ma

try using the unix lsof command to see which program has the lock

lsof | grep mysql

EDIT:in fact, run lsof on the lock itself

lsof /var/lock/subsys/mysql
0 votes
answered Sep 15, 2017 by nauman

For this similar error:

service mysql status ERROR! MySQL is not running, but lock file (/var/lock/subsys/mysql) exists

Follow these steps:

  1. rm /var/lock/subsys/mysql rm:

    remove regular empty file /var/lock/subsys/mysql? y

    Press y

  2. /etc/init.d/mysql start.

    If the error occurs again after starting MYSQL then execute ps -ef | grep mysql

  3. Kill all processes of MySQL and repeat steps 1 & 2.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...