How do I start or stop MySQL Server in Linux

Through this tutorial, you will learn quick and easy methods you can use to start, stop, and restart the MySQL Server in Linux.

How do I start or stop MySQL Server in Linux

Service management is a crucial skill for any Linux user. Whether you are just getting started in Linux or have tons of experience, you are going to come across instances where you need to start, stop, or restart a service in your Linux system.

NOTE: This guide is tested on

  1. MySQL Server -  MySQL Server version 8.0
  2. Linux Distribution - Ubuntu 22.10, 22.04, 20.10,  20.04 and Debian 10, 11

Before running the commands provided in this guide, verify you have your target MySQL Server version installed on your system.

You can view our tutorials on how to install MySQL version 5.0 or 8.0 on Ubuntu, Debian, CentOS, Fedora, and OpenSUSE.

Start, Stop, and Restart MySQL Using system V Init Scripts

One of the most popular ways to manage services in Linux using system v scripts. You can explore our tutorial on system v init scripts to learn more.

MySQL Start

To start MySQL using System V Init Script:

sudo service mysqld start

MySQL Stop

To stop the MySQL Service, run:

sudo service mysqld stop

MySQL Restart

To restart the Service:

sudo service mysqld restart

Manually Execute the System V Init Scripts

In some cases, your target machine may not have the service command installed. In such as case, you can manually call the startup scripts to start, stop or restart the MySQL Server.

Manually Start MySQL

sudo /etc/init.d/mysqld start

Manually Stop MySQL

sudo /etc/init.d/mysqld stop

Manually Restart MySQL

sudo /etc/init.d/mysqld restart

Start, Stop, and Restart MySQL with Systemd

Finally, we have the popular service management utility: systemd. We can use the system control utility to manage the services.

Systemd Start MySQL

sudo systemctl start mysqld

Systemd Stop MySQL

sudo systemctl stop mysqld

Systemd Restart MySQL

sudo systemctl restart mysqld

Final

And there you have it!, several methods for starting, stopping, and restarting MySQL Server on Linux systems.

If you enjoy our content, please consider buying us a coffee to support our work:

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.