How to Install MariaDB on AlmaLinux 10
MariaDB is a freely available open-source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). It is a drop-in replacement for MySQL, known for its performance, reliability, and rich features, making it a popular choice for many developers and system administrators.
Prerequisites
Before installing MariaDB on AlmaLinux 10, ensure you have the following:
-
A system running AlmaLinux 10 with root or sudo access.
-
A working internet connection to download packages.
- SELinux and firewall are appropriately configured (optional but recommended).
Update the System
Before proceeding with any installation, it's a good practice to update the system to ensure all packages are current and compatible. This reduces the chance of conflicts or dependency issues.
Run the following command to update all packages:
dnf update -y
Install MariaDB
To install MariaDB, run the following commands,
dnf install mariadb mariadb-server
Output:
[root@vps ~]# dnf install mariadb mariadb-server
Last metadata expiration check: 0:13:43 ago on Wed Jun 4 19:14:51 2025.
Dependencies resolved.
=============================================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================================
Installing:
mariadb x86_64 3:10.11.11-1.el10 appstream 1.6 M
mariadb-server x86_64 3:10.11.11-1.el10 appstream 9.9 M
Installing dependencies:
checkpolicy x86_64 3.8-1.el10 appstream 357 k
libaio x86_64 0.3.111-22.el10 baseos 24 k
mariadb-common noarch 3:10.11.11-1.el10 appstream 35 k
mariadb-connector-c
Start and Enable MariaDB Service
Start the MariaDB service and enable it to automatically start on boot by running the following commands,
systemctl enable --now mariadb
systemctl start mariadb
Check the MariaDB Service
To verify that the MariaDB service is running:
systemctl status mariadb
Output:
[root@vps ~]# systemctl status mariadb
● mariadb.service - MariaDB 10.11 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
Active: active (running) since Wed 2025-06-04 19:42:37 UTC; 4s ago
Invocation: 24dd08e1f00c480ba7257eed9c0c033d
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 2139 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS)
Process: 2162 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS)
Process: 2261 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS)
Main PID: 2249 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 11 (limit: 23188)
Memory: 207M (peak: 231.5M)
CPU: 545ms
CGroup: /system.slice/mariadb.service
└─2249 /usr/libexec/mariadbd --basedir=/usr
Securing MariaDB
Secure your MariaDB installation by running the security script,
mysql_secure_installation
Output:
[root@vps ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
... Success!
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password:
Re-enter new password:
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Verify Installation
Once secured, you can connect to MariaDB and review the existing databases on your server by running,
mysql -u root -p -e "SHOW DATABASES;
Output:
[root@vps ~]# mysql -u root -p -e "SHOW DATABASES;"
Enter password:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
Conclusion
You have now successfully installed and secured MariaDB on AlmaLinux 10. The database service is up and running, configured to start on boot, and protected with a root password and secure defaults. MariaDB is now ready for your application or development use.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS