Controlling the MySQL or MariaDB service is the fastest way to recover from outages, apply configuration changes, and schedule maintenance without guessing whether the database daemon is actually running.
On most modern Linux systems, the database server runs as the mysqld daemon under systemd, which exposes a unit such as mysql.service, mariadb.service, or mysqld.service. The systemctl command is the primary interface for starting, stopping, restarting, and checking health, with status output also showing recent log lines from the unit.
Service names and unit aliases vary by distribution and package, so confirming the exact unit name prevents “Unit not found” errors. Restarting the service terminates existing database connections, and disabling a unit only changes boot-time behavior without stopping a currently running daemon, so maintenance windows and application impact still matter.
$ systemctl list-unit-files --type=service | grep --extended-regexp '^(mysql|mariadb|mysqld)\.service' mysql.service enabled enabled
Use the unit name shown on the left in later commands.
$ sudo systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
Active: active (running) since Mon 2025-12-29 10:59:07 UTC; 4s ago
Process: 958 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 966 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 9396)
Memory: 365.6M (peak: 381.2M)
CPU: 348ms
CGroup: /system.slice/mysql.service
└─966 /usr/sbin/mysqld
Dec 29 10:59:07 host systemd[1]: Starting mysql.service - MySQL Community Server...
Dec 29 10:59:07 host systemd[1]: Started mysql.service - MySQL Community Server.
Replace mysql with mariadb or mysqld when that is the unit name on the host.
Some MariaDB packages expose mysql.service as a compatibility alias.
$ sudo systemctl stop mysql
Stopping the service drops active connections and can break applications until the service starts again.
$ sudo systemctl start mysql
$ sudo systemctl restart mysql
Restarting interrupts active sessions and can cause transient errors in clients during the restart window.
$ sudo systemctl disable mysql Synchronizing state of mysql.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install disable mysql Removed "/etc/systemd/system/multi-user.target.wants/mysql.service".
disable changes boot behavior only, so a running service remains running until a separate stop.
Replace mysql with mysqld for RedHat-based platforms.
$ sudo systemctl enable mysql Synchronizing state of mysql.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable mysql Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /usr/lib/systemd/system/mysql.service.
$ sudo journalctl --unit=mysql.service --no-pager --lines=50 Dec 29 10:59:07 host systemd[1]: Starting mysql.service - MySQL Community Server... Dec 29 10:59:07 host systemd[1]: Started mysql.service - MySQL Community Server. Dec 29 10:59:26 host systemd[1]: Stopping mysql.service - MySQL Community Server... ##### snipped #####
Replace mysql.service with the unit discovered earlier, such as mariadb.service or mysqld.service.
$ systemctl is-active mysql active
$ systemctl is-enabled mysql enabled