Technology Encyclopedia Home >How to restart MariaDB?

How to restart MariaDB?

To restart MariaDB, you can use the following methods depending on your operating system:

1. Using Systemd (Linux systems like Ubuntu 16.04+, CentOS 7+)

Run the following command in the terminal:

sudo systemctl restart mariadb

Or (if the service is named mysql instead of mariadb):

sudo systemctl restart mysql

2. Using SysVinit (older Linux systems)

Use the service command:

sudo service mariadb restart

Or:

sudo service mysql restart

3. Directly via MariaDB Command Line (if you have root access)

If you can access the MariaDB shell as root, you can restart it with:

SET GLOBAL innodb_fast_shutdown = 0;  
SHUTDOWN;  

Then start it again from the system service (as shown above).

Example Scenario

If you're managing a MariaDB database on a Tencent Cloud CVM (Cloud Virtual Machine) and need to restart the service after configuration changes, use:

sudo systemctl restart mariadb

Ensure the service starts successfully by checking its status:

sudo systemctl status mariadb

For Tencent Cloud Database for MariaDB, restarting is managed via the Tencent Cloud Console or API. Navigate to the Database Instance page, select your MariaDB instance, and click Restart in the operation menu.

If you encounter issues, check logs at /var/log/mysql/error.log or /var/log/mariadb/mariadb.log.