使用kill无法杀死mysql进程
问题背景:由于忘记了root密码,在没有关闭mysqld的进程时候,又执行了mysqld_safe --skip-grant-tables --skip-networking & 命令
然后发现mysql开启了两个进程
ps -ef|grep mysql|grep -v mysql
root 6528 5942 0 15:26 pts/3 00:00:00 /bin/sh /application/mysql/bin/mysqld_safe --skip-grant-tables
mysql 6684 6528 1 15:26 pts/3 00:00:08 /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --skip-grant-tables --log-error=db01.err --pid-file=db01.pid --socket=/tmp/mysql.sock --port=3306
[root@db01:~]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1491/sshd
tcp6 0 0 :::3306 :::* LISTEN 6684/mysqld
tcp6 0 0 :::22 :::* LISTEN 1491/sshd
使用kill、pkill、killall都无法杀死mysql进程,一直会重新启动一个新的进程,systemctl stop mysqld.service这个命令也不管用
/application/mysql/bin/mysqld_safe: line 198: 6684 Killed nohup /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --skip-grant-tables --log-error=db01.err --pid-file=db01.pid --socket=/tmp/mysql.sock --port=3306 < /dev/null > /dev/null 2>&1
2019-09-08T07:36:25.218090Z mysqld_safe Number of processes running now: 0
2019-09-08T07:36:25.225914Z mysqld_safe mysqld restarted
/application/mysql/bin/mysqld_safe: line 198: 7025 Killed nohup /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --skip-grant-tables --log-error=db01.err --pid-file=db01.pid --socket=/tmp/mysql.sock --port=3306 < /dev/null > /dev/null 2>&1 > /dev/null 2>&1
2019-09-08T07:36:39.819259Z mysqld_safe Number of processes running now: 0
2019-09-08T07:36:39.825030Z mysqld_safe mysqld restarted
/application/mysql/bin/mysqld_safe: line 198: 7071 Killed nohup /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --skip-grant-tables --log-error=db01.err --pid-file=db01.pid --socket=/tmp/mysql.sock --port=3306 < /dev/null > /dev/null 2>&1 > /dev/null 2>&1 > /dev/null 2>&1
2019-09-08T07:36:59.687319Z mysqld_safe Number of processes running now: 0
2019-09-08T07:36:59.693581Z mysqld_safe mysqld restarted
/application/mysql/bin/mysqld_safe: line 198: 7117 Killed nohup /application/mysql/bin/mysqld --basedir=/application/mysql --datadir=/application/mysql/data --plugin-dir=/application/mysql/lib/plugin --user=mysql --skip-grant-tables --log-error=db01.err --pid-file=db01.pid --socket=/tmp/mysql.sock --port=3306 < /dev/null > /dev/null 2>&1 > /dev/null 2>&1 > /dev/null 2>&1 > /dev/null 2>&1
2019-09-08T07:37:07.345563Z mysqld_safe Number of processes running now: 0
2019-09-08T07:37:07.352287Z mysqld_safe mysqld restarted
后来使用/application/mysql/support-files/mysql.server stop停止成功