本地连接远程mysql服务报错:MySQL is running but PID file could not be found [FAILED]

Posted 一宿君

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了本地连接远程mysql服务报错:MySQL is running but PID file could not be found [FAILED]相关的知识,希望对你有一定的参考价值。

错误:

去服务器查看mysql运行状态:

service mysqld status

报错日志:

MySQL is running but PID file could not be found           [FAILED]

mysql运行了但是没有找到PID文件

本地sqlyog连接报错日志:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

重启mysql服务:

service mysqld restart

停止mysql服务:

service mysqld stop

都是这个错误:

MySQL is running but PID file could not be found           [FAILED]

我不能忍,我也就是几天没玩这个服务器,都弄个这事,然后就在网上扒拉扒拉,总结如下:

第一步:找到mysql-bin.index文件

[root@yixiujun mysql]# find / -name mysql-bin.index;

第二步:删mysql-bin.index文件

[root@yixiujun mysql]# rm -rf /www/server/data/mysql-bin.index;

//这个路径是你的服务器上查询出来的
/www/server/data/mysql-bin.index;  

第三步:找到所有有关mysql的进程

[root@yixiujun mysql]# ps -aux | grep mysql;


第四步:kill杀进程(能杀的都杀了)

[root@yixiujun mysql]# kill 1469;
[root@yixiujun mysql]# kill 2164;
[root@yixiujun mysql]# kill 65550;
[root@yixiujun mysql]# kill 66807;

杀完再检查一下:

[root@yixiujun mysql]# ps -aux | grep mysql;
//下面这个杀不掉不用管
root     1915167  0.0  0.0  12132  1072 pts/0    S+   10:38   0:00 grep --color=auto mysql

第五步:再次查看mysql运行状态:

[root@yixiujun mysql]# service mysqld status;

不出意外会出现下面这个玩意:

MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED]

第六步:发现有一个系统文件被锁了,进入上述路径/var/lock/subsys,把mysql文件删了:

[root@yixiujun subsys]# rm -rf ./mysql;

第七步:再次查看mysql运行状态

[root@yixiujun subsys]# service mysqld status
MySQL is not running                                       [FAILED]

耶,对比一下上述出现的日志:

//现在
MySQL is not running                                       [FAILED]

//上述
MySQL is running but PID file could not be found           [FAILED]

这说明啥,说明pid进程文件找到了!那这个时候咱们再看看咋样了!

第八步:启动一下msql

[root@yixiujun subsys]# service mysqld start;
Starting MySQL..                                           [  OK  ]

看到这个[OK],启动成功,内心真的很哇塞!!!


扩展:

如果忘记了登录密码看下文:
连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)

以上是关于本地连接远程mysql服务报错:MySQL is running but PID file could not be found [FAILED]的主要内容,如果未能解决你的问题,请参考以下文章

MySQL——远程连接非本地MySQL数据库服务器,报错ERROR 1130: Host 192.168.3.100 is not allowed to connect to this MySQL s

本地数据库连接服务器报错`1130 - Host ‘219.232.77.43‘ is not allowed to connect to this MySQL server`

本地数据库连接服务器数据库报错`1130 - Host ‘219.232.77.43‘ is not allowed to connect to this MySQL server`

连接内网服务器上的mysql报错

MySQL 1130 - Host 127.0.0.1 is not allowed to connect to this MySQL server

远程连接mysql报错:1130 - Host XXX is not allowed to connect to this MySQL server