1. 程式人生 > >Linux中mysql自啟解決方案

Linux中mysql自啟解決方案

由於MySQL有一個守護程序,MySQL_safe這樣的,所以每次強制殺死,它都會自動啟動

[[email protected] ~]# netstat -nlp | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      39634/mysqld        
[[email protected] ~]# kill -9 39634
[[email protected] ~]# netstat -nlp | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      47499/mysqld 

檢視程序:ps -ef | grep mysqld

[[email protected] ~]# ps -ef | grep mysqld
mysql     47499 117002  0 22:34 ?        00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-tables --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root      47581  38070  0 22:35 pts/4    00:00:00 grep --color=auto mysqld
root     117002      1  0 03:15 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables

kill掉mysqld_safe主程序 由於主程序會預設去保護子程序 所以kill掉主程序子程序的保護也就沒有了也就不會再自啟了

[[email protected] ~]# kill -9 117002
[[email protected] ~]# kill -9 47499  
[[email protected] ~]# ps -ef | grep mysqld
root      47616  38070  0 22:36 pts/4    00:00:00 grep --color=auto mysqld