問題背景:由於忘記了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停止成功