Skip to content
Runbook

Install MariaDB on Fedora / RHEL

Open source SQL database, a community-developed drop-in replacement for MySQL.

Databasesqlrdbmsrelationaldatabaseacidmysql-compatible

Installation

Server (Fedora repositories) · dnf
sudo dnf install -y mariadb-server

MariaDB is Fedora's default MySQL-compatible database.

Verify the installation

Verify
mariadb --version

Service

Start
sudo systemctl start mariadb
Stop
sudo systemctl stop mariadb
Status
sudo systemctl status mariadb
Restart
sudo systemctl restart mariadb
On boot
sudo systemctl enable mariadb

Important files

TypePathDescription
config/etc/my.cnfMain configuration file (includes /etc/my.cnf.d).
data/var/lib/mysqlData directory.
log/var/log/mariadb/mariadb.logServer log.

Default ports

3306

Command-line tools

  • mariadbInteractive SQL client (mysql is kept as a symlink).
  • mariadb-adminAdministrative client.
  • mariadb-secure-installationHardening script for the installation.

Uninstall

Uninstall
sudo systemctl stop mariadb
sudo dnf remove -y mariadb-server

The /var/lib/mysql directory remains; delete it manually to wipe everything.

Good to know

  • The data directory is initialized automatically on the first systemctl start mariadb.
  • Run mariadb-secure-installation after the first start to set the root password.
  • MariaDB is Fedora's default; the separate community-mysql package would conflict on port 3306.

Installation on Fedora

MariaDB is the default MySQL-compatible database on Fedora. sudo dnf install -y mariadb-server installs the server; enable and start it with sudo systemctl enable --now mariadb. The data directory is initialized automatically on first start.

First connection and security

After the first start, run sudo mariadb-secure-installation to set the root password, remove anonymous accounts, and drop the test database. Connect with sudo mariadb (unix_socket auth) or mariadb -u root -p once a password is set.

MariaDB vs MySQL on Fedora

Fedora also packages Oracle MySQL as community-mysql. The two cannot run on port 3306 at the same time; pick one. MariaDB is the upstream-default and integrates most smoothly with the distribution.