MySQL mysql进程无法停止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14161415/
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
mysql process cannot be stopped
提问by ljmelgui
I have recently installed 5.5.28-29.2 Percona Server (GPL), Release 29.2 in a Ubuntu 12.04 OS Desktop. I have tried to stop the server using different methods:
我最近在 Ubuntu 12.04 操作系统桌面上安装了 5.5.28-29.2 Percona Server (GPL), Release 29.2。我尝试使用不同的方法停止服务器:
- sudo /etc/init.d/mysql stop
- sudo kill -9 pid
- mysqladmin -u root -p shutdown
All this methods stop the process, however it starts up automatically after it dies. I have checked syslog (/var/log/syslog/) and always shows me the next trace:
所有这些方法都会停止该过程,但是它会在它死后自动启动。我已经检查了 syslog (/var/log/syslog/) 并且总是向我显示下一个跟踪:
Jan 4 17:50:44 kernel: [ 1915.494219] init: mysql main process (17311) killed by KILL signal
Jan 4 17:50:44 kernel: [ 1915.494245] init: mysql main process ended, respawning
Jan 4 17:50:44 kernel: [ 1915.500025] type=1400 audit(1357318244.557:48): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=18458 comm="apparmor_parser"
Jan 4 17:50:46 /etc/mysql/debian-start[18501]: Upgrading MySQL tables if necessary.
Jan 4 17:50:46 /etc/mysql/debian-start[18504]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Jan 4 17:50:46 /etc/mysql/debian-start[18504]: Looking for 'mysql' as: /usr/bin/mysql
Jan 4 17:50:46 /etc/mysql/debian-start[18504]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jan 4 17:50:46 /etc/mysql/debian-start[18504]: This installation of MySQL is already upgraded to 5.5.28, use --force if you still need to run mysql_upgrade
Jan 4 17:50:46 /etc/mysql/debian-start[18515]: Checking for insecure root accounts.
Jan 4 17:50:46 /etc/mysql/debian-start[18520]: Triggering myisam-recover for all MyISAM tables
Do you know the reason why the process restarts automatically ? Thank you in advance!!
你知道进程自动重启的原因吗?先感谢您!!
回答by The New Guy
I was having this exact same problem. Running the kill
command would kill the process, but in my case it would keep popping up again under a different process ID.
我遇到了完全相同的问题。运行该kill
命令会终止进程,但在我的情况下,它会在不同的进程 ID 下再次弹出。
The only way I could figure out how to stop it for good was this:
我能弄清楚如何永远阻止它的唯一方法是:
sudo stop mysql
Hope that helps.
希望有帮助。
Source: http://www.itfromscratch.com/how-to-stop-the-percona-mysql-server/
来源:http: //www.itfromscratch.com/how-to-stop-the-percona-mysql-server/
回答by alessio
Using sudo service mysql stop
worked for me.
使用sudo service mysql stop
对我有用。
回答by Ray
Want to kill all mysql instances? Try as root:
想要杀死所有 mysql 实例吗?以 root 身份尝试:
pkill mysqld;
回答by Jason Swett
I'm using Homebrew on Mac OS. brew services stop mysql
did notwork for me, but sudo brew services stop mysql
did.
我在 Mac OS 上使用 Homebrew。brew services stop mysql
并没有为我工作,但sudo brew services stop mysql
没有。
回答by RobNY
For those looking at this years after the fact, I had a similar issue and just solved it.
对于那些事后看到这一年的人,我遇到了类似的问题并刚刚解决了它。
Seems there was a second init script called orig_mysql.conf that existed in the /etc/init directory along with the mysql.conf file. This caused upstart to start two instances and apparently it got confused when one was ended. As such a continuous respawning took place.
似乎还有一个名为 orig_mysql.conf 的初始化脚本与 mysql.conf 文件一起存在于 /etc/init 目录中。这导致暴发户启动了两个实例,显然在一个实例结束时它感到困惑。因此,连续重生发生了。
My solution:
我的解决方案:
- Stop mysql via upstart if possible:
service mysql stop
- REMOVE one of the conf files (I removed /etc/init/orig_mysql.conf). Then restart init using:
telinit u
- Kill off any remaining mysqld processes manually.
- 如果可能,通过 upstart 停止 mysql:
service mysql stop
- 删除 conf 文件之一(我删除了 /etc/init/orig_mysql.conf)。然后使用以下命令重新启动 init:
telinit u
- 手动终止任何剩余的 mysqld 进程。
Once you confirm you have no mysqld processes running and that they are not respawning any longer, restart mysql with service mysql start
.
一旦您确认没有 mysqld 进程正在运行并且它们不再重新生成,请使用service mysql start
.
Hope this helps someone. It took me two years to solve this.
希望这可以帮助某人。我花了两年时间才解决这个问题。
回答by ESG
I'm going to guess here, but mysqld might be started via the mysql_safe init script, which will restart the server.
我会在这里猜测,但 mysqld 可能是通过 mysql_safe init 脚本启动的,这将重新启动服务器。
回答by dmarges
This might not apply to this particular problem but here it goes anyways. I checked the error log ("/var/log/mysql/error.log") and saw that "explicit_defaults_for_timestamp=TRUE" was causing an error ("Unknown variable"). So I removed it from my.cnf ("/etc/mysql/my.cnf"), and ran "sudo start mysql" and it was back up and running. I hope this helps as well!
这可能不适用于这个特定问题,但无论如何它都在这里。我检查了错误日志(“/var/log/mysql/error.log”)并看到“explicit_defaults_for_timestamp=TRUE”导致错误(“未知变量”)。所以我从 my.cnf(“/etc/mysql/my.cnf”)中删除了它,并运行“sudo start mysql”,它被备份并运行。我希望这也有帮助!