How to Install MariaDB Server in AlmaLinux

Since AlmaLinux has Red Hat Enterprise Linux binary compatibility, this free and open-source Linux OS distribution projects production-grade, and community-supported OS attributes.

These traits make AlmaLinux an ideal candidate for web-based applications. When it comes to the development and production of such applications, the need for an ideal and performant database management software is mandatory.

Installing MariaDB in AlmaLinux

An updated system is optimized for better performance and security patches fixes.

$ sudo dnf update && sudo dnf upgrade -y 

Next, install MariaDB database management software on your AlmaLinux system by running the following command.

$ sudo dnf install mariadb-server -y
Install MariaDB in AlmaLinux
Install MariaDB in AlmaLinux

Once installed, confirm the MariaDB version with the following command:

$ mysql --version 
Check MySQL Version
Check MySQL Version

Next, start and enable the MariaDB database server to keep running even after the computer hosting it restarts or gets a shutdown request and reboots afterward.

$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
$ sudo systemctl status mariadb

The latter command checks to ensure that your MariaDB database software is up and running.

Check MySQL Status in AlmaLinux
Check MySQL Status in AlmaLinux

Securing MariaDB in AlmaLinux

The following MySQL security script lets you set a root database user password, disallow remote login if necessary, and remove anonymous database users among other configurations.

$ sudo mysql_secure_installation
Secure MariaDB in AlmaLinux
Secure MariaDB in AlmaLinux

Access your MariaDB database with the new root user credentials you just created.

$ mysql -u root -p 

Create a database user, database, and assign control over the created database to the user.

MariaDB [(none)]> CREATE USER [email protected] IDENTIFIED BY "Your_preferred_db_user_password";
MariaDB [(none)]> CREATE DATABASE linuxshelltips_db;
MariaDB [(none)]> GRANT ALL ON linuxshelltips_db.* TO [email protected]; 
MariaDB [(none)]> exit 

This article guide has taken us through the installation and configuration of the MariaDB server on AlmaLinux. If database management was a missing piece in your web-based projects, you are now set to go.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

Got Something to Say? Join the Discussion...

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.