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


当前回答

在OSX雪豹

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

其他回答

Use:

sudo mysqladmin shutdown --user=*user* --password=*password*

不使用sudo也能逃脱惩罚。例如,用户可以是root(即MySQL root用户)。

在我的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文件来运行

显然你想:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop

你可以进一步阅读《Jeez People,停止为安装RMagic而烦恼》。

你可以使用命令"mysqladmin shutdown"

sudo / opt /地方/ etc / LaunchDaemons / org.macports.mysql5 / mysql5。包装器停止

您还可以在这里使用start和restart。我通过查看/Library/LaunchDaemons/org.macports.mysql.plist的内容发现了这一点。