tags:

views:

6751

answers:

7

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)

+2  A: 

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/

Dan
A: 

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.

Bartosz Blimke
This will stop it from starting when you reboot, which is not what the poster was asking for.
Matthew Schinckel
+4  A: 

You can always use command "mysqladmin shutdown"

Rimantas
The commands above didn't work for me. This one did. Not sure what the difference is in my setup, but thanks.
Marco
+1  A: 

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).

John Montgomery
+14  A: 

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
mloughran
+2  A: 

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.

katy lavallee
this worked for me thanks :)
Kurund Jalmi
A: 
zack