google cloud platform

How to Start Stop Restart MariaDB on Linux OS ?

This tutorial guides you on how to Start Stop Restart MariaDB server on Linux OS.

How to Start Stop Restart MariaDB on Linux OS

MariaDB is the community-developed MySQL relational database management systems (RDBMS) and it is free and open-source software under GNU GPL. And MariaDB is popular and one of the pillar in LAMP stack.

Note, major platforms like Google Cloud Platform Marketplace solutions use MariaDB as their database component. For example, openlitespeed-wordpress uses MariaDB. This solution gives you OpenLiteSpeed, PHP, MySQL Server, WordPress, LiteSpeed Cache, and other useful applications and it is 300+ times faster than regular WordPress.

In fact, I am running my WordPress website with MariaDB server. Further, let’s get in to our topic on how to start, stop and restart MariaDB server. Also let’s see how to check MariaDB server status.

How to Start MariaDB

In the older systems, you need to use the following command to start MariaDB server.

# sudo service mysql start

And, in the newer systems, use the following command to start the server.

$ sudo systemctl start mariadb

How to Stop MariaDB

Similarly, in the older systems, use the following command to stop the MariaDB server.

# sudo service mysql stop

And, in the newer systems, run the following command.

# sudo systemctl stop mariadb

How to Restart MariaDB

To restart MariaDB in older systems, execute the following command.

# sudo service mysql restart

In the newer systems, run the following command to restart the server.

# sudo systemctl restart mariadb

How to check MariaDB Status

You need to run the following command in older systems to check MariaDB server status.

# sudo service mysql status

● mariadb.service - MariaDB 10.4.14 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Sat 2021-01-09 03:33:45 UTC; 2min 30s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 630811 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 630821 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 630824 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, st>
    Process: 630999 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 631001 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 630967 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 32 (limit: 682)
     Memory: 76.0M
     CGroup: /system.slice/mariadb.service
             └─630967 /usr/sbin/mysqld

Jan 09 03:33:44 openlitespeed-wordpress-1-vm systemd[1]: mariadb.service: Succeeded.
Jan 09 03:33:44 openlitespeed-wordpress-1-vm systemd[1]: Stopped MariaDB 10.4.14 database server.
Jan 09 03:33:44 openlitespeed-wordpress-1-vm systemd[1]: Starting MariaDB 10.4.14 database server...
Jan 09 03:33:45 openlitespeed-wordpress-1-vm systemd[1]: Started MariaDB 10.4.14 database server.

And run the following command in newer systems to check the status.

# sudo systemctl status mariadb

That’s it. You had learnt how to start, stop and restart MariaDB server on Linux OS. And also learnt how to check the server status.

Hope it helped 🙂

References

Leave a Reply

avatar
  Subscribe  
Notify of