Managing the MySQL or MariaDB service turns configuration edits, crash recovery, and maintenance windows into controlled database changes instead of guesses about whether the daemon is running.
On Linux hosts that use systemd, the database server runs under a unit such as mysql.service, mysqld.service, or mariadb.service. systemctl is the standard interface for reading status, starting or stopping the daemon, changing boot behavior, and checking whether the service actually came back after a restart.
Package naming varies by vendor and distribution, so confirm the unit before sending a stop or restart. Oracle MySQL uses mysql.service on Debian and Ubuntu packages and mysqld.service on RPM packages. MariaDB packages use mariadb.service; some packages also provide mysql.service or mysqld.service aliases, and MariaDB socket activation can let mariadb.socket start the service on demand.
$ systemctl list-unit-files mysql.service mariadb.service mysqld.service UNIT FILE STATE PRESET mariadb.service enabled enabled mysql.service alias - mysqld.service alias - 3 unit files listed.
Use the real unit shown on the left in the rest of the commands. When more than one name appears, prefer the unit whose state is not alias.
$ sudo systemctl status mariadb.service --no-pager
● mariadb.service - MariaDB 11.8.6 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled)
Active: active (running) since Sat 2026-06-06 20:47:55 UTC; 7s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 97 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 15 (limit: 94614)
Memory: 292.9M (peak: 299.8M)
CPU: 894ms
##### snipped #####
Jun 06 20:47:55 dbhost mariadbd[97]: 2026-06-06 20:47:55 0 [Note] /usr/sbin/mariadbd: ready for connections.
Jun 06 20:47:55 dbhost systemd[1]: Started mariadb.service - MariaDB 11.8.6 database server.
Replace mariadb.service with mysql.service or mysqld.service when that is the unit on the host. systemctl status is the quickest human-readable view because it shows the current state plus the most recent journal lines for the unit.
$ sudo systemctl stop mariadb.service
Stopping the service drops active sessions and interrupts applications until the daemon starts again.
If MariaDB socket activation has been started with systemctl start mariadb.socket, a new local or TCP connection can start mariadb.service again. Stop mariadb.socket too when the server must stay down for planned maintenance.
$ sudo systemctl start mariadb.service
$ sudo systemctl restart mariadb.service
A restart disconnects clients and can surface transient application errors while the server process exits and comes back.
$ systemctl is-active mariadb.service active
systemctl is-active is useful for scripts and runbooks because it returns success only while the named unit is active.
$ sudo journalctl --unit=mariadb.service --no-pager --lines=20 Jun 06 20:48:03 dbhost mariadbd[224]: 2026-06-06 20:48:03 0 [Note] InnoDB: innodb_buffer_pool_size_max=128m, innodb_buffer_pool_size=128m ##### snipped ##### Jun 06 20:48:03 dbhost mariadbd[224]: 2026-06-06 20:48:03 0 [Note] Server socket created on IP: '127.0.0.1', port: '3306'. Jun 06 20:48:03 dbhost mariadbd[224]: 2026-06-06 20:48:03 0 [Note] /usr/sbin/mariadbd: ready for connections. Jun 06 20:48:03 dbhost systemd[1]: Started mariadb.service - MariaDB 11.8.6 database server.
Use the discovered unit file name, such as mysql.service, mysqld.service, or mariadb.service. journalctl shows more context than the short log excerpt inside systemctl status.
$ sudo systemctl disable mariadb.service Synchronizing state of mariadb.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install disable mariadb Removed '/etc/systemd/system/multi-user.target.wants/mariadb.service'.
Use disable --now mariadb.service instead when you also want to stop the running service immediately.
$ sudo systemctl enable mariadb.service Synchronizing state of mariadb.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable mariadb Created symlink '/etc/systemd/system/multi-user.target.wants/mariadb.service' → '/usr/lib/systemd/system/mariadb.service'.
Use enable --now mariadb.service if the service should also start immediately as part of the same change.
$ systemctl is-enabled mariadb.service enabled
Replace mariadb.service with the unit name discovered earlier. alias or static results usually mean the current unit name points to another service definition rather than being the primary boot target itself.