Home AlmaLinux How to Install MariaDB Server in AlmaLinux

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 linuxshelltips@localhost IDENTIFIED BY "Your_preferred_db_user_password";
MariaDB [(none)]> CREATE DATABASE linuxshelltips_db;
MariaDB [(none)]> GRANT ALL ON linuxshelltips_db.* TO linuxshelltips@localhost; 
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.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

1 thought on “How to Install MariaDB Server in AlmaLinux”

  1. Hi,

    I’m new to AlmaLinux and MariaDB. I am moving from the defunct CentOS platform. Installing and setting up MariaDB, with the help of your tutorial was simple and saved me a lot of time.

    I will return as questions come up. Thank you for providing a migration path away from CentOS. I selected MariaDB over MySQL because it’s possible that MySQL could go the way of CentOS and I don’t want that headache.

    Thanks, again. Greg Steward


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.