MySQL 如何停止mysqld
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11091414/
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
How to stop mysqld
提问by David542
To find out the start command for mysqld (using a mac) I can do:
要找出 mysqld 的启动命令(使用 mac),我可以这样做:
ps aux|grep mysql
I get the following output, which allows me to start mysql server.
我得到以下输出,它允许我启动 mysql 服务器。
/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=...
How would I find the necessary command to stop mysql from the command line?
我如何从命令行找到停止 mysql 的必要命令?
回答by squiter
Try:
尝试:
/usr/local/mysql/bin/mysqladmin -u root -p shutdown
Or:
或者:
sudo mysqld stop
Or:
或者:
sudo /usr/local/mysql/bin/mysqld stop
Or:
或者:
sudo mysql.server stop
If you install the Launchctl in OSXyou can try:
如果您在 OSX 中安装Launchctl,您可以尝试:
MacPorts
端口
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql.plist
Note: this is persistent after reboot.
注意:这在重新启动后是持久的。
Homebrew
家酿
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Binary installer
二进制安装程序
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
I found that in: https://stackoverflow.com/a/102094/58768
回答by Pirooz
There is an alternative way of just killing the daemon process by calling
有一种替代方法可以通过调用来终止守护进程
kill -TERM PID
where PID
is the value stored in the file mysqld.pid
or the mysqld process id which can be obtained by issuing the command ps -a | grep mysqld
.
哪里PID
是存储在文件中的值mysqld.pid
或可以通过发出命令获得的 mysqld 进程 ID ps -a | grep mysqld
。
回答by bb94
回答by Lokinder Singh Chauhan
For Windows, you can run this command directly if mysql/bin is in your path.
对于 Windows,如果 mysql/bin 在您的路径中,您可以直接运行此命令。
mysqladmin -u root -p shutdown
回答by Vito Gravano
I did it with next command:
我用下一个命令做到了:
sudo killall mysqld
回答by ppostma1
On OSX 10.8 and on, the control for MySQL is available from the System Configs. Open System Preferences, click on Mysql (usually on the very bottom) and start/stop the service from that pane. https://dev.mysql.com/doc/refman/5.6/en/osx-installation-launchd.html
在 OSX 10.8 及更高版本上,可以从系统配置中获得对 MySQL 的控制。打开系统偏好设置,单击 Mysql(通常在最底部)并从该窗格启动/停止服务。 https://dev.mysql.com/doc/refman/5.6/en/osx-installation-launchd.html
The plist file is now under /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
plist 文件现在位于 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
回答by Steven Lizarazo
for Binary installer use this:
对于二进制安装程序,请使用:
to stop:
停止:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
to start:
开始:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
to restart:
重启:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
回答by ceskamx
Worked for me on mac
在 mac 上为我工作
a) Stop the process
a) 停止进程
sudo launchctl list | grep -i mysql
If the result shows anything like:"xxx.xxx.mysqlxxx"
如果结果显示类似:“xxx.xxx.mysqlxxx”
sudo launchctl remove xxx.xxx.mysqlxxx
Example:
sudo launchctl remove org.macports.mysql56-server
例子:
sudo launchctl remove org.macports.mysql56-server
b) Disable to autostart the process
b) 禁用自动启动进程
sudo launchctl unload -wF /Library/LaunchDaemons/xxx.xxx.mysqlxxx.plist
Example:
sudo launchctl unload -wF /Library/LaunchDaemons/org.macports.mysql56-server.plist
例子:
sudo launchctl unload -wF /Library/LaunchDaemons/org.macports.mysql56-server.plist
- Finally reboot your mac
- 最后重启你的mac
Note: In some cases if you tried "a)"first, you need to reboot again before try b).
注意:在某些情况下,如果您先尝试了“a)”,则需要在尝试b)之前再次重新启动。
回答by Andreas Karz
Kill is definitly the wrong way! The PID will stay, Replicationsjobs will be killed etc. etc.
Kill 绝对是错误的方式!PID 将保留,Replicationsjobs 将被终止等等。
STOP MySQL Server
停止 MySQL 服务器
/sbin/service mysql stop
/sbin/service mysql 停止
START MySQL Server
启动 MySQL 服务器
/sbin/service mysql start
/sbin/service mysql 启动
RESTART MySQL Server
重启 MySQL 服务器
/sbin/service mysql restart
/sbin/service mysql 重启
Perhaps sudo will be needed if you have not enough rights
如果您没有足够的权限,也许需要 sudo
回答by arnoldbird
Try killing mysqld four times in a row. It's the only thing that worked for me...
尝试连续四次杀死 mysqld。这是唯一对我有用的东西......
root@ubuntu:/etc/init# killall -KILL mysqld
root@ubuntu:/etc/init# killall -KILL mysqld
root@ubuntu:/etc/init# killall -KILL mysqld
root@ubuntu:/etc/init# killall -KILL mysqld
mysqld: no process found
Just keep killing it over and over until you see "mysqld: no process found".
只需一遍又一遍地杀死它,直到您看到“mysqld:未找到进程”。