MariaDB start / stop / restart / status check
Explains how to start / stop / restart / check the status of MariaDB.
MariaDB status check
To check the status of MariaDB, use "status" of the systemctl command.
sudo systemctl status mariadb
If it is running
If it is running, the following will be displayed.
● mariadb.service --MariaDB 10.1.44 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2020-05-18 12:38:49 JST; 22h ago Docs: man: mysqld (8) https://mariadb.com/kb/en/library/systemd/ Main PID: 33941 (mysqld) Status: "Taking your SQL requests now ..." Tasks: 27 (limit: 9479) CGroup: /system.slice/mariadb.service mq33941 / usr / sbin / mysqld May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Processing databases May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: information_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: mysql May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: performance_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Phase 6/7: Checking and upgrading tables May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Processing databases May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: information_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: performance_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Phase 7/7: Running'FLUSH PRIVILEGES' May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: OK </pre>
When stopped
If it is stopped, the following will be displayed.
● mariadb.service --MariaDB 10.1.44 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: inactive (dead) since Tue 2020-05-19 10:53:02 JST; 6s ago Docs: man: mysqld (8) https://mariadb.com/kb/en/library/systemd/ Process: 33941 ExecStart = / usr / sbin / mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code = exited, status = 0 / SUCCESS) Main PID: 33941 (code = exited, status = 0 / SUCCESS) Status: "MariaDB server is down" May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: mysql May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: performance_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Phase 6/7: Checking and upgrading tables May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Processing databases May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: information_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: performance_schema May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: Phase 7/7: Running'FLUSH PRIVILEGES' May 18 12:38:50 development-batch / etc / mysql / debian-start [33977]: OK May 19 10:53:01 development-batch systemd [1]: Stopping MariaDB 10.1.44 database server ... May 19 10:53:02 development-batch systemd [1]: Stopped MariaDB 10.1.44 database server.
Starting MariaDB
MariaDB is started using the systemctl command "start". Run with root privileges using the sudo command.
sudo systemctl start mariadb
Even if the boot is successful, the message that it was successful is not returned. Please check the status.
MariaDB outage
To stop MariaDB, use the systemctl command "stop". Run with root privileges using the sudo command.
sudo systemctl stop mariadb
If the outage is successful, no successful message will be returned. Please check the status.
Restart MariaDB
To restart MariaDB, use the systemctl command "restart". Run with root privileges using the sudo command.
sudo systemctl restart mariadb
restart simply executes the stop command and executes the start command.
To see the MariaDB start / stop log
Servers such as MariaDB are centrally managed by a program called systemd.
MariaDB start / stop log is output to systemd log.
Use the journalctl command to see the systemd logs. Specify the unit "mariadb" with the "-u" option. Please note that you will not be able to see the mariadb log unless you run it with sudo. If you want to see only the last part of the log, combine the "-r" option.
sudo journalctl -r -u mariadb
This is a sample log.
--Logs begin at Mon 2020-06-01 15:51:16 JST, end at Thu 2020-07-23 14:33:01 JST. - Jul 22 13:24:37 shinshina-development-app-00000001 / etc / mysql / debian-start [1896]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables Jul 22 13:24:37 shinshina-development-app-00000001 / etc / mysql / debian-start [1869]: Checking for insecure root accounts. Jul 22 13:24:37 shinshina-development-app-00000001 / etc / mysql / debian-start [1826]: This installation of MySQL is already upgraded to 10.1.44-MariaDB, use --force if you still need to run mysql_upgrade Jul 22 13:24:37 shinshina-development-app-00000001 / etc / mysql / debian-start [1826]: Looking for'mysqlcheck' as: / usr / bin / mysqlcheck Jul 22 13:24:37 shinshina-development-app-00000001 / etc / mysql / debian-start [1826]: Looking for'mysql' as: / usr / bin / mysql Jul 22 13:24:37 shinshina-development-app-00000001 / etc / mysql / debian-start [1826]: / usr / bin / mysql_upgrade: the'--basedir' option is always ignored Jul 22 13:24:36 shinshina-development-app-00000001 systemd [1]: Started MariaDB 10.1.44 database server. Jul 22 13:24:36 shinshina-development-app-00000001 / etc / mysql / debian-start [1822]: Upgrading MySQL tables if necessary. Jul 22 13:24:35 shinshina-development-app-00000001 mysqld [1536]: 2020-07-22 13:24:35 139798878784640 [Note] / usr / sbin / mysqld (mysqld 10.1.44-MariaDB-0ubuntu0.18.04 .1) starting as process 1536 ... Jul 22 13:24:33 shinshina-development-app-00000001 systemd [1]: Starting MariaDB 10.1.44 database server ... --Reboot - Jul 22 13:13:50 shinshina-development-app-00000001 systemd [1]: Stopped MariaDB 10.1.44 database server. Jul 22 13:13:47 shinshina-development-app-00000001 systemd [1]: Stopping MariaDB 10.1.44 database server ... </pre> <h3> To see MariaDB's systemd configuration file </h3> MariaDB's systemd configuration file can be found under "systemctl status mariadb". Let's take a look at the configuration file with the <a href="https://en.linux.perlzemi.com/blog/20200113083613.html"> cat command</a>. <pre> cat /lib/systemd/system/mariadb.service
Other MariaDB information
To install MariaDB
The following article explains how to install MariaDB.
Installing mariadb-server --MariaDB database server
MariaDB configuration file
MariaDB's configuration file will be discussed in another article.