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
Once installed, confirm the MariaDB version with the following command:
$ 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.
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
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)]> FLUSH PRIVILEGES; 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.