Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql is dead but subsys locked

Tags:

I am using PHP-mysql on Linux (RHEL 5.0) For First Time
When I tried to connect to MySQL from my PHP Script using mysqli_connect.
It Displayed The Following Error:

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

After googling for hour I found solution to this as stated here.

When I followed that approach and issued command:

service mysqld status 

as a root user I got : mysql is dead but subsys locked Any one know how to solve this and cause of this error ?

Also

  • Restarting
  • Starting
  • And Stopping of MySQL
is Giving Output as: FAILED
But PHP is working fine. I've tested the phpinfo(); for Demo.
I've installed MySQL in /usr/local/mysql/bin. Can Anyone Help me in this ? Any help is appreciated.


Thanks in advance.

like image 205
Vedant Terkar Avatar asked Oct 14 '13 10:10

Vedant Terkar


2 Answers

I had this problem with my OTRS server after I tried to update a to large package.

The solution was:

copy for safty:

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

than delete it

rm /var/lock/subsys/mysqld 

than close all services that depends on mysql:

service httpd stop service otrs stop 

after that:

service mysqld restart service httpd restart service otrs restart 

System is CentOS 6.x

like image 152
Jonathan H. Avatar answered Oct 14 '22 03:10

Jonathan H.


service mysqld restart 

Simply restarting the mysqld worked fro me on Centos.

like image 24
Mayank Jaiswal Avatar answered Oct 14 '22 04:10

Mayank Jaiswal