今天想把之前在cetnos6上編譯安裝的mariadb改下PATH環境變量,操作幾次之後,關閉或重啟mysql就失敗了,提示如下:
[root@web1 ~]# service mysqld stop
MySQL server PID file could not be found! [FAILED]
google了下,解決方案如下:
查看一下進程:
[root@web1 ~]# ps aux |grep mysq*
mysql 16058 0.2 11.2 995540 112956 ? Sl 14:07 0:01 mysqld
root 17233 0.0 0.0 103316 848 pts/2 S+ 14:16 0:00 grep mysq*
如果看到上面的內容,那說明,Mysql的進程卡死了,這時用就要把這些卡死的進程都關閉:
[root@web1 ~]# kill -9 16058
[root@web1 ~]# kill -9 17233
-bash: kill: (17233) - No such process
再啟動Mysql 就行了;可以多重啟幾次,最後就成功啟動了。
[root@web1 ~]# service mysqld stop
MySQL server PID file could not be found! [FAILED]
[root@web1 ~]# service mysqld restart
MySQL server PID file could not be found! [FAILED]
Starting MySQL.. [ OK ]
[root@web1 ~]# service mysqld restart
Shutting down MySQL. [ OK ]
Starting MySQL.. [ OK ]
[root@web1 ~]#