MySQL Ubuntu 无法停止 mysqld

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18733944/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 18:47:59  来源:igfitidea点击:

Ubuntu can't stop mysqld

ubuntumysql

提问by Rose Perrone

I try running service mysql stop, killall -s SIGKILL mysqld, /etc/init.d/mysql stop, and stop mysql, but still I see this output from ps aux | grep mysql:

我尝试运行service mysql stop, killall -s SIGKILL mysqld, /etc/init.d/mysql stop, and stop mysql,但我仍然看到以下输出ps aux | grep mysql

root     32302  0.0  0.3  59040  2120 pts/8    S    06:03   0:00 sudo mysqld_safe
root     32305  0.0  0.1   4440   772 pts/8    S    06:03   0:00 /bin/sh /usr/bin/mysqld_safe
mysql    32651  0.1  6.8 426740 41388 pts/8    Sl   06:03   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

回答by Tom Silverman

The only thing that worked for me is partially explained here.

唯一对我有用的东西在这里进行了部分解释。

If everything else fails, try this:

如果其他一切都失败了,试试这个:

root@myhost:/usr/bin# initctl --system stop mysql

After that you can start controlling mysql normally using

之后你就可以开始正常使用 mysql 控制了

root@myhost:/usr/bin# /etc/init.d/mysql start

Or

或者

root@myhost:/usr/bin# initctl --system start mysql

回答by Adem ?zta?

You can use pkill mysqld

您可以使用 pkill mysqld

Linux man page: pkill

Linux 手册页:pkill

回答by Borniet

If all else fails, use

如果所有其他方法都失败,请使用

kill -9 "processid"

or

或者

kill -s "processid"

kill -s "processid"

回答by leopold

You might be in safe mode. Hence all processes will be respawned right away.

您可能处于安全模式。因此,所有进程都将立即重新生成。

But the following should work.
Mind to replace root with the username

但以下应该工作。
注意用用户名替换 root

mysqladmin -u root -p shutdown

To restart

重启

sudo service mysql start

回答by Luyang Du

For those of you who keeps seeing this when you try to kill mysqld_safe:

对于那些在尝试杀死 mysqld_safe 时一直看到这一点的人:

2019-05-06T14:47:13.251226Z mysqld_safe Number of processes running now: 0 2019-05-06T14:47:13.253591Z mysqld_safe mysqld restarted
2019-05-06T14:48:31.097077Z mysqld_safe Number of processes running now: 0 2019-05-06T14:48:31.102834Z mysqld_safe mysqld restarted

2019-05-06T14:47:13.251226Z mysqld_safe 现在运行的进程数:0 2019-05-06T14:47:13.253591Z mysqld_safe mysqld 重新启动
2019-05-06T14.Z097 运行的 mysqls_safe 进程数:037037 -05-06T14:48:31.102834Z mysqld_safe mysqld 重新启动

Use killall -9 mysqld mysqld_safeI think if you just kill mysqld_safe, mysqld will be spawned and when it sees there is no mysqld_safe. It treats as an error and start mysqld_safe again...This is my guess.

使用killall -9 mysqld mysqld_safe我想如果你只是杀死 mysqld_safe,mysqld 将被产生,当它看到没有 mysqld_safe 时。它将视为错误并再次启动 mysqld_safe...这是我的猜测。