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)?
If you installed the MySQL 5 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 the mysql5-devel package.
mysql5-devel