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 are using homebrew you can use
homebrew
brew services restart mysql brew services start mysql brew services stop mysql
for a list of available services
brew services list