下面可以参考下面的方法步骤解决。最后查到一个网友说可能和log文件有关,于是将log文件给移除了,再重启MySQL终于OK了
启动MySQL出错,查看了下状态,发现提示MySQL is not running,but lock exists:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
一个网友说可能和log文件有关,于是将log文件给移除了,再重启MySQL终于OK了文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
找了下资料,基本上都是说:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
- # chown -R mysql:mysql /var/lib/mysql
- # rm /var/lock/subsys/mysql
- # service mysql restart
执行完发现还是这个提示。文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
因为是在cPanel服务器上,所以又通过命令:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
- # yum remove mysql mysql-server
将mysql卸载了,然后重新安装:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
- # /scripts/mysqlup –force
装好之后发现重启还是出错,又认真看了下,发现pid文件不是以当前的主机名命名的,于是执行:文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/51794.html
- # echo `ps aux | grep mysql | grep “user=mysql” | grep -v “grep” | awk ‘{print $2}'`>> hostname.pid
重新生成了下pid文件,同时修改owner和group为mysql:
- # chown mysql:mysql hostname.pid
之后保存再重启还是出错。
最后查到一个网友说可能和log文件有关,于是将log文件给移除了,再重启MySQL终于OK了。
A MySQL crash on Red Hat system resulted with:
/etc/init.d/mysql status
coming back with:
mysql is not running but lock exists
Solved by removing the lock file:
rm /var/lock/subsys/mysql
If this happens again it may also be necessary to remove the pid file from /var/lib/mysql
评论