我通过MacPorts安装MySQL。我需要什么命令来停止服务器(我需要测试当MySQL死时我的应用程序如何行为)?


当前回答

你可以使用命令"mysqladmin shutdown"

其他回答

对于Mac M1 Pro,进入系统设置和Mysql在底部,然后点击停止Mysql服务器:

如果你正在使用自制啤酒,你可以使用

brew services restart mysql
brew services start mysql
brew services stop mysql

获取可用服务的列表

brew services list

在OSX雪豹

launchctl unload /System/Library/LaunchDaemons/org.mysql.mysqld.plist

在我的mac osx yosemite 10.10。这个命令起作用了:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysql.plist

你可以在/Library/LaunchDaemons/文件夹中找到你的mysql文件来运行

如果你安装了MacPorts的MySQL 5包:

sudo launchctl  unload -w /Library/LaunchDaemons/org.macports.mysql.plist 

Or

sudo launchctl  unload -w /Library/LaunchDaemons/org.macports.mysql5-devel.plist 

如果您安装了mysql5-devel包。