I installed it it via mac ports, what is the command I need to stop the server (i need to test how my app behave when MySQL is dead)
Apparently you want:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
Have a further read here: http://www.simplisticcomplexity.com/2007/10/27/start-and-stop-mysql-in-mac-os-x-105-leopard/
If you installed mysql5 package with macports:
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql.plist
or
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5-devel.plist
if you installed mysql5-devel package.
Well if all else fails you could just take the ruthless approach and kill the process running mysql manually.
i.e. "ps -Af
" to list all processes, then do "kill <pid>
" where <pid>
is the process id of the mysql daemon (mysqld).
There are two cases depending on whether you installed mysql with the official binary installer or using macports:
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.
Binary installer
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart
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.