Install MariaDB / MySQL on Fedora Linux

Relational database like MariaDB is one of the required components to setup a web server as well as other less common uses such as when configuring a shared Kodi database. On Arch Linux MySQL has been replaced by a practically functionally identical community fork called MariaDB.


Install MariaDB

Install from official repository.

sudo dnf install mariadb mariadb-server


Configure MariaDB

Secure the installation.


Make sure you set root password, remove anonymous users and disallow root login remotely unless you know you will need remote access to MariaDB. There should also be no need to keep test database so remove test database and access to it. Finish the install process with reload privilege tables now.


Create firewalld rule.

sudo bash -c 'cat > /usr/lib/firewalld/services/mariadb.xml << EOF
<?xml version="1.0" encoding="utf-8"?>
  <description>MariaDB Service</description>
  <port protocol="tcp" port="3306"/>


Reload the configuration for the new service to be detected.

sudo firewall-cmd --reload


Add the rule permanently.

sudo firewall-cmd --permanent --add-service=mariadb


Reload the configuration for the changes to apply.

sudo firewall-cmd --reload


Run MariaDB

Start the service with systemd.

sudo systemctl start mariadb


Enable the service to start on boot.

sudo systemctl enable mariadb


Use MariaDB

Invoke the command line tool.

sudo mysql -u root -p

The username is specified with -u option follower by the username which is root by default. The password is specified with the -p option followed by the password without a space in between or the password can be omitted in which case MariaDB will prompt for one.


List all existing databases.



List all database users.



Use command line or Install phpMyAdmin to administer MariaDB / MySQL databases.