How to stop mysqld

David542 picture David542 · Jun 18, 2012 · Viewed 455k times · Source

To find out the start command for mysqld (using a mac) I can do:

ps aux|grep mysql

I get the following output, which allows me to start mysql server.

/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=...

How would I find the necessary command to stop mysql from the command line?

Answer

squiter picture squiter · Jun 18, 2012

Try:

/usr/local/mysql/bin/mysqladmin -u root -p shutdown 

Or:

sudo mysqld stop

Or:

sudo /usr/local/mysql/bin/mysqld stop

Or:

sudo mysql.server stop

If you install the Launchctl in OSX you can try:

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.

Homebrew

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Binary installer

sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart

I found that in: https://stackoverflow.com/a/102094/58768