
This tutorial will explain how to install MariaDB on AlmaLinux 10. MariaDB is an open-source relational database management system used for storing data. MariaDB is written in C, C++, Perl, an57d Bash and is highly compatible with MySQL, with exact matching with MySQL APIs and commands. It was developed by the original developers of MySQL and designed as a drop-in replacement for MySQL. MariaDB is used because it is fast, scalable, and robust, with a rich system of storage engines and plugins. The following paragraphs will teach you how to install MariaDB, manage the service, and use some basic commands for login, creating a database, and users in the MariaDB console.
Installing the MariaDB database system is straightforward and may take up to 15 minutes. Let’s get started!
Table of Contents
Prerequisites
- A server running AlmaLinux 10 or any Linux OS
- User privileges: root or non-root user with sudo privileges
Update the system
Before we start with the MariaDB database system installation process, it is recommended that the system packages be updated to their latest available versions. To do that, execute the following command:
sudo dnf update -y && sudo dnf upgrade -y
Install MariaDB Database Server
MariaDB packages are in the latest AlmaLinux 10 repository by default. So to install the MariaDB database server, execute the command below:
sudo dnf install mariadb-server -y
After the installation is completed, you can check the installed MariaDB version with the following command:
mysql -V
You should get the following output:
[root@host ~]# mysql -V mysql Ver 15.1 Distrib 10.11.9-MariaDB, for Linux (x86_64) using EditLine wrappe
Manage the MariaDB Service
Once installed, start and enable the MariaDB database service:
sudo systemctl start mariadb && sudo systemctl enable mariadb
To check the status of the service, execute the command below:
sudo systemctl status mariadb
You should get the following output:
● mariadb.service - MariaDB 10.11 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled) Active: active (running) since Sat 2025-03-28 13:42:38 CDT; 7s ago Invocation: 8b830e16e6434c75bcd782667fffffd6 Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 31307 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 11 (limit: 23175) Memory: 208M (peak: 236.1M) CPU: 2.241s CGroup: /system.slice/mariadb.service └─31307 /usr/libexec/mariadbd --basedir=/usr
To restart the MariaDB service, execute the following command:
sudo systemctl restart mariadb
To stop the MariaDB service, you can use the command below:
sudo systemctl stop mariadb
Secure MariaDB Installation
The security of MariaDB is the most critical part of the installation. We need to set up a strong root password, remove any anonymous users, remove test databases, etc. This can be done by executing the following command:
sudo mysql_secure_installation
After running this command, you need to follow the prompts. It should look like this:
Enter current password for root (enter for none): Hit Enter Switch to unix_socket authentication [Y/n] n Change the root password? [Y/n] Y New password: YourStrongPasswordHere Re-enter new password:YourStrongPasswordHere Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Create MariaDB Database and User
Now let’s create a test database and test database using the MariaDB console. First, log in to the MariaDB console using the following command:
mysql -u root -p
You need to enter the root password you set in the previous step:
[root@host ~]# mysql -u root -p Enter password: YourStrongPasswordHere
Once logged in, you will see the following screen:
[root@host ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 15 Server version: 10.11.9-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
Now, to create a test database, database user, and assign the proper permissions, execute the following commands one by one in the MySQL terminal:
CREATE DATABASE testdb; CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere'; GRANT ALL ON testdb.* TO 'testuser'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
MySQL Dump and MySQL Import Database
A MySQL dump is a .sql file containing the database tables and their data. It is used to create a database backup. To make a database dump of the database, you need to execute the following command:
mysqldump -u testuser -p testdb > testdb.sql
MySQL import is used to import the database from the backup. The MySQL import imports the previously dumped backup of the database .sql file. To import the database, you can use the following command:
mysql -u testuser -p testdb < testdb.sql
As you can see, the only difference between the MySQL export and import is the > AND < operator. The > is used for the MySQL dump while the < is for MySQL import.
That’s it. You learned how to install and manage the MariaDB database system and some basic commands on AlmaLinux 10.
Of course, you don’t have to do this if you have difficulties and are unfamiliar with Linux and MySQL servers. You can always contact our technical support. You only need to sign up for one of our AlmaLinux VPS plans and submit a support ticket. We are available 24/7 and will take care of your request immediately.
If you liked this post about installing MariaDB on AlmaLinux 10, please share it with your friends or leave a comment below.