Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

systemctl says Unit mariadb.service not found on Fedora

ErrorFailed to start mariadb.service: Unit mariadb.service not found.

Short answer

systemd only knows a unit once the package that ships it is installed. On Fedora the service is mariadb.service and it comes from the mariadb-server package. If you installed only the client, or installed MySQL instead (the two packages conflict), the unit does not exist. Install mariadb-server, then enable the service.

  • Applies to Fedora (dnf), MariaDB 11.8
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the package manager which database packages are installed and whether any of them owns a mariadb unit file.

    rpm -qa | grep -i -E 'mariadb|mysql'
    systemctl list-unit-files | grep -i -E 'mariadb|mysql'
  2. 2Match what you see, then jump to its fix

    1. 1rpm lists mariadb but not mariadb-server, and no mariadb.service line appearsOnly the client package is installedFix
    2. 2rpm lists mysql-server and no mariadb-serverMySQL is installed instead of MariaDBFix

What does the error look like?

  • Failed to start mariadb.service: Unit mariadb.service not found.

Cause 1 of 2

Only the client package is installed

1Check

On Fedora, mariadb and mariadb-server are separate packages. The server one carries the service.

rpm -q mariadb mariadb-server

2Fix

Install the server package and start the service now and at boot. The documented service name on Fedora is mariadb.

sudo dnf install mariadb-server
sudo systemctl enable --now mariadb

3Verify

The service reports active.

systemctl status mariadb

Confirmed by fedoraproject.org

Did this fix it?

Cause 2 of 2

MySQL is installed instead of MariaDB

1Check

MariaDB and MySQL packages conflict on Fedora, so only one of them can be installed at a time. If mysql-server is present, there is no mariadb unit.

rpm -q mysql-server mariadb-server

2Fix

Decide which one you want. To keep MySQL, leave it and do not install MariaDB. To switch, back up your data first, remove the MySQL server package, then install mariadb-server as above.

sudo dnf remove mysql-server
sudo dnf install mariadb-server
sudo systemctl enable --now mariadb

3Verify

Connect as root through the socket, which needs no password by default.

mysql -u root

Confirmed by fedoraproject.org

Did this fix it?

How do I stop it coming back?

  • Install the server package by its full name (mariadb-server), not just mariadb.
  • Pick MariaDB or MySQL once per machine and do not mix repositories.
  • Use dnf search mariadb to see the versions your Fedora release offers before installing.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.