我通过MacPorts安装MySQL。我需要什么命令来停止服务器(我需要测试当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包。

其他回答

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

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

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

这适用于macOS 10.13.6和8.0.12 MySQL

/usr/local/mysql/support-files / mysql。服务器启动

/usr/local/mysql/support-files / mysql。服务器重启

/usr/local/mysql/support-files / 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包。

在OSX雪豹

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