Restart Start Stop MySQL Server from Command Line, macOS, Linux

To restart, start or stop MySQL or mariadb database servers from the command line, type the following at the shell prompt…

On Linux start/stop/restart from the command line:

 /etc/init.d/mysqld start
 /etc/init.d/mysqld stop
 /etc/init.d/mysqld restart

Some Linux flavors offer the service command too

 service mysqld start
 service mysqld stop
 service mysqld restart


 service mysql start
 service mysql stop
 service mysql restart

On macOS Big Sur, Sierra & OSX to start/stop/restart MySQL post 5.7 from the command line:

sudo launchctl load -F /Library/LaunchDaemons/
sudo launchctl unload -F /Library/LaunchDaemons/

On OS X to start/stop/restart MySQL pre 5.7 from the command line:

 sudo /usr/local/mysql/support-files/mysql.server start
 sudo /usr/local/mysql/support-files/mysql.server stop
 sudo /usr/local/mysql/support-files/mysql.server restart

Mysql Mariadb Restart Start Stop



  1. Joel on September 10, 2021 at 5:32 pm

    same here I have the same problem with mampro I cannot stop the mysql with big sur

  2. Scott on May 3, 2021 at 2:45 pm

    For MacOS Big Sur, the above commands are not working to stop MySQL. They can not be found according to the system.

Leave all Comment