如何在 Mac OS 安装上停止 MySQL?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/100948/
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 do you stop MySQL on a Mac OS install?
提问by Laurie Young
回答by mloughran
There are different cases depending on whether you installed MySQLwith the official binary installer, using MacPorts, or using Homebrew:
根据您是使用官方二进制安装程序、使用MacPorts还是使用Homebrew安装MySQL,有不同的情况:
MacPorts
端口
sudo port load mysql57-server
sudo port unload mysql57-server
Note: this is persistent after a 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
回答by pjammer
For those who used homebrew to install MySQL use the following commands below to start, stop, or restart MySQL
对于使用自制软件安装 MySQL 的用户,请使用以下命令来启动、停止或重新启动 MySQL
Brew start
酿造开始
/usr/local/bin/mysql.server start
Brew restart
酿造重启
/usr/local/bin/mysql.server restart
Brew stop
酿造停止
/usr/local/bin/mysql.server stop
回答by Rimantas
You can always use command "mysqladmin shutdown"
您始终可以使用命令“mysqladmin shutdown”
回答by Jan
If you are using homebrew
you can use
如果您正在使用,homebrew
您可以使用
brew services restart mysql
brew services start mysql
brew services stop mysql
for a list of available services
获取可用服务列表
brew services list
回答by Moesio
sudo /usr/local/mysql/support-files/mysql.server stop
须藤/usr/local/mysql/support-files/mysql.server 停止
回答by katy lavallee
sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop
sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper stop
You can also use start and restart here. I found this by looking at the contents of /Library/LaunchDaemons/org.macports.mysql.plist.
您也可以在此处使用 start 和 restart 。我通过查看 /Library/LaunchDaemons/org.macports.mysql.plist 的内容发现了这一点。
回答by Dan
Apparently you want:
显然你想要:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
Have a further read in Jeez People, Stop Fretting Over Installing RMagic.
回答by zack
Try
尝试
sudo <path to mysql>/support-files/mysql.server start
sudo <path to mysql>/support-files/mysql.server stop
Else try:
其他尝试:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop<br>
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
However, I found that the second option only worked (OS X 10.6, MySQL 5.1.50) if the .plist has been loaded with:
但是,我发现如果 .plist 已加载,则第二个选项仅适用(OS X 10.6,MySQL 5.1.50):
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
PS: I also found that I needed to unload the .plist to get an unrelated install of MAMP-MySQL to start / stop correctly. After running running this, MAMP-MySQL starts just fine:
PS:我还发现我需要卸载 .plist 才能获得无关的MAMP-MySQL安装才能正确启动/停止。运行运行后,MAMP-MySQL 启动得很好:
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
回答by Duc Chi
On my mac osx yosemite 10.10. This command worked:
在我的 mac osx 优胜美地 10.10 上。此命令有效:
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysql.plist
You can find your mysql file in folder /Library/LaunchDaemons/ to run
您可以在文件夹 /Library/LaunchDaemons/ 中找到您的 mysql 文件来运行