Start/Stop the MySQL server

This tutorial walks you through how to start/stop/restart a MySQL server on Linux and Windows.

To use the MySQL database server correctly, you should know how to start, stop, and restart the MySQL server first.

Start/stop MySQL on Linux

After completing the MySQL installation on Linux, mysql is normally installed as a service. Depending on the Linux distribution, the name of the service may be mysqld or mysql.

The service command was provided in earlier Linux versions, so you can control the MySQL server with the following command:

  • Start the MySQL server

    sudo service mysqld start
    
  • Stop the MySQL server

    sudo service mysqld stop
    
  • Restart the MySQL server

    sudo service mysqld restart
    

The service command was provided in recent Linux versions, so you can control the MySQL server with the following command:

  • Start the MySQL server

    sudo systemd start mysqld
    
  • Stop the MySQL server

    sudo service stop mysqld
    
  • Restart the MySQL server

    sudo service restart mysqld
    

On some Linux distributions, use mysql instead of mysqld in the commands above.

Windows start/stop MySQL

On Windows, MySQL is also installed as a service. Please go through the following steps to manage the MySQL server.

  1. Open the service management application, find the mysql service,
  2. Double-click the mysql service to pop up the service dialog window.
  3. Choose the appropriate action to start, stop or restart the MySQL server.

Conclusion

In this tutorial, you learned how to start/stop/restart a MySQL server on Linux and Windows.