I installed MySQL via MacPorts. What is the command I need to stop the server (I need to test how my application behave when MySQL is dead)?
Apparently you want:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
Have a further read in Jeez People, Stop Fretting Over Installing RMagic.