Linux mysql 已死,但 subsys 已锁定

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19358194/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:05:04  来源:igfitidea点击:

mysql is dead but subsys locked

phplinuxrhelmysql

提问by Vedant Terkar

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:

第一次Linux (RHEL 5.0)上使用 PHP-mysql
当我尝试使用 mysqli_connect 从我的 PHP 脚本连接到 MySQL 时。
它显示以下错误:

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.

谷歌搜索一小时后,我找到了解决方案,如here所述

When I followed that approach and issued command:

当我遵循这种方法并发出命令时:

service mysqld status

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

作为 root 用户,我得到了: mysql is dead but subsys locked有人知道如何解决这个问题以及导致这个错误的原因吗?

Also

  • Restarting
  • Starting
  • And Stopping of MySQL
  • 重启
  • 开始
  • 和停止 MySQL
给出输出为: FAILED 失败


但 PHP 工作正常。我已经测试了phpinfo();phpinfo();Demo。


我已经在/usr/local/mysql/bin/usr/local/mysql/bin. 任何人都可以帮助我吗?任何帮助表示赞赏。


Thanks in advance.


提前致谢。

采纳答案by Jonathan H.

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

在我尝试将一个大包更新后,我的 OTRS 服务器出现了这个问题。

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:

而不是关闭所有依赖于 mysql 的服务:

service httpd stop
service otrs stop

after that:

在那之后:

service mysqld restart
service httpd restart
service otrs restart

System is CentOS 6.x

系统为 CentOS 6.x

回答by fsgf

first,make sure that /etc/init.d/mysqld is running from /usr/local/mysql/bin then,kill mysqld ,delete the lock file and restart it.

首先,确保 /etc/init.d/mysqld 正在从 /usr/local/mysql/bin 运行,然后杀死 mysqld ,删除锁定文件并重新启动它。

回答by user3018158

  1. tail /var/log/mysqld.log to check the error log
  2. then do the following actions:

    rm /var/lock/subsys/mysqld chown -R mysql.mysql /var/run/mysqld

  1. tail /var/log/mysqld.log 查看错误日志
  2. 然后执行以下操作:

    rm /var/lock/subsys/mysqld chown -R mysql.mysql /var/run/mysqld

回答by Mayank Jaiswal

service mysqld restart

Simply restarting the mysqld worked fro me on Centos.

只需重新启动 mysqld 就可以在 Centos 上为我工作。

回答by Saladin

Rebooting the server worked for me. Please remember to start all the services once you reboot in case you haven't added 'chkconfig' for them, lets say httpd, named and mysql.

重新启动服务器对我有用。请记住在重新启动后启动所有服务,以防您没有为它们添加“chkconfig”,比如 httpd、named 和 mysql。

回答by Dale Anderson

This (and all sorts of other weird errors) can also happen if you have a full disk. In my case, my /var partition had filled up. Freeing up space allowed mysqld to restart again.

如果您的磁盘已满,也会发生这种情况(以及各种其他奇怪的错误)。就我而言,我的 /var 分区已满。释放空间允许 mysqld 再次重新启动。

回答by danangnurfauzi

i use command kill, step by step:

我使用命令kill,一步一步:

  1. use command service mysqld status for find PID mysqld
  2. kill -9 PID
  3. use command service mysqld status again for find PID mysqld
  4. kill -15 PID
  5. check again with command service mysqld status , check until the PID dead OR subsys locked
  6. use command service mysqld start
  1. 使用命令 service mysqld status 查找 PID mysqld
  2. 杀死 -9 PID
  3. 再次使用命令 service mysqld status 来查找 PID mysqld
  4. 杀死 -15 PID
  5. 使用命令 service mysqld status 再次检查,检查直到 PID dead 或 subsys 锁定
  6. 使用命令 service mysqld start

回答by Abhik Bose

First find the PID number of mysqld:

 1. Use top | grep mysqld
 2. kill -9 PID

Safe method, works fine with Cent OS

首先找到mysqld的PID号:

 1.使用top | grep mysqld
 2. kill -9 PID

安全方法,适用于 Cent OS

回答by accfcx

The problem I meet in the project is because of the disk space run out.

我在项目中遇到的问题是因为磁盘空间用完了。

The server that MySQL is running run out the disk space, business project's log is too large. The result is that MySQL restart failed.

MySQL运行的服务器磁盘空间不足,业务项目日志过大。结果是MySQL重启失败。

It is one probability and you can have a try.

这是一种可能性,您可以尝试一下。

du -sh *

杜 -sh *

and

service mysqld restart

服务 mysqld 重启