How to Restart MariaDB on Ubuntu 22.04


In the last post, we discussed different approaches for checking the installed version of MariaDB on Ubuntu 22.04. Now moving toward the next topic, we will elaborate on different approaches for restarting MariaDB on Ubuntu 22.04.

You may need to restart the MariaDB service on Ubuntu to apply configuration changes, resolve performance or security issues, troubleshoot problems, or restart the service intentionally through “systemctl” and “service” commands. More specifically, restarting the service may cause temporary downtime for applications that rely on it.

The contents of this post are:

  • Method 1: Restart MariaDB on Ubuntu 22.04 Using the systemctl Command
  • Method 2: Restart MariaDB on Ubuntu 22.04 Using the service Command
  • Method 3: Restart MariaDB on Ubuntu 22.04 Using the init.d Script

Method 1: Restart MariaDB on Ubuntu 22.04 Using the systemctl Command

The “systemctl” is a command-line utility used to manage and control services and processes in a Linux system. In the following method, we will specifically utilize the “systemctl” command for restarting MariaDB on Ubuntu 22.04.

Step 1: Open the terminal

Press “CTRL+ALT+T” to launch the terminal:

Step 2: Restart MariaDB

Utilize the following command to restart MariaDB:

sudo systemctl restart mariadb

Step 3: Check MariaDB Status

For checking out the current status of MariaDB, run the mentioned command:

sudo systemctl status mariadb

It is apparent that the MariaDB service has been restarted.

Method 2: Restart MariaDB on Ubuntu 22.04 Using the service Command

The “service” is a command-line utility used to manage system services on Linux distributions. It can be used for restarting as well as checking its status.

Step 1: Restart MariaDB

Use the service command to restart MariaDB on Ubuntu 22.04 as mentioned:

sudo service mariadb restart

Step 2: Check MariaDB status

The service command can be used for checking MariaDB status as well:

sudo service mariadb status

It can be observed that the MariaDB service has been restarted.

Method 3: Restart MariaDB on Ubuntu 22.04 Using the init.d Script

The “init.d” script is a collection of shell scripts that are used to start, stop, and manage system services on Linux distributions. More specifically, it can be utilized for restarting MariaDB on Ubuntu 22.04.

Step 1: Restart MariaDB

To restart MariaDB on Ubuntu 22.04, execute the following command:

sudo /etc/init.d/mariadb restart

Step 2: Check MariaDB Status

The status of the MariaDB service can be checked by executing the command:

sudo /etc/init.d/mariadb status

That’s how you can restart and check the status of MariaDB on Ubuntu 22.04.

Conclusion

To restart MariaDB on Ubuntu 22.04, you can utilize the “systemctl”, “service” commands, and “init.d” script as well. Before choosing one of the mentioned methods, you have to launch the terminal. To use the first approach, execute “sudo systemctl restart mariadb” in the terminal.

For the second approach, run the “sudo service mariadb restart” command. Implementation of the third approach can be done by running the “sudo /etc/init.d/mariadb restart” in the terminal. That’s how you can restart and check the status of MariaDB on Ubuntu 22.04.

Follow Linux Genie to remain up-to-date related to the latest trends and technologies!

Print Friendly, PDF & Email
Categories