How to Start/Stop MySQL Server on Ubuntu?

MySQL Server is a free and open-source relational database management system that is utilized to store and manage data. Ubuntu allows users to install, run, start, or stop MySQL Server services to manage their databases, tables, queries, and many more.

This article will provide a detailed explanation to start and stop the MySQL Server service on Ubuntu:

Note: To install MySQL on Ubuntu, follow the link.

How to Start the MySQL Server on Ubuntu? 

The “systemctl” command is utilized to manage system services by starting or stopping. To start the MySQL Server service, follow these steps:

Step 1: Start the MySQL Server Service

To start the MySQL Server service, use the “systemctl” command with the “start” option in the terminal window:

$ sudo systemctl start mysql

The output command shows that the MySQL Server service has been started and makes it available for use.

Step 2: Verify the Status of the MySQL Server Service 

To verify that the MySQL Server service is running, utilize the “systemctl” command with the “status” option. It displays information about the current status of the MySQL Server service, including whether it is running or stopped:

$ sudo systemctl status mysql


This output indicates that the MySQL Server service is running and has been active for a certain amount of time.

How to Stop the MySQL Server on Ubuntu?

To stop the MySQL Server service, follow the step-by-step instructions which are given below:

 Step 1: Stop the MySQL Server Service

To stop the MySQL Server service, specify the “systemctl” command with the “stop” option by specifying the “mysql” in the terminal window:

$ sudo systemctl stop mysql

It stops the MySQL Server service and prevents any further access to the server until the service is started again.

Step 2: Verify the MySQL Server Service

Users can now verify that the MySQL Server service is no longer running by typing the “systemctl” command with the “status” option in the terminal:

$ sudo systemctl status mysql

This output indicates that the MySQL Server service is not running and has been inactive since a certain time.

Conclusion

To start and stop the MySQL server on Ubuntu, execute the “sudo systemctl start mysql” and “sudo systemctl stop mysql” commands. After the start/stop, it is recommended to check the status of the MySQL Server service using the “sudo systemctl status mysql” command. This article has briefly demonstrated methods to start and stop the MySQL server’s service on Ubuntu.

Over 500 Million Views on Our Blogs and YouTube! We’re inviting 10 businesses to partner with us and grow together. Click here to join us! ×