How to Install MariaDB on Rocky Linux 8

Install MariaDB on Rocky Linux 8

In this article, we will have explained the necessary steps to install ImageMagick on Rocky Linux. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

MariaDB is a community-driven fork of MySQL relational database management system. MariaDB gives improved performance over MySQL and offers better storage engines, a larger and faster connection pool, speed, and replication improvements. It is compatible with a wide range of operating systems including Linux, FreeBSD, Mac, and Windows.

Install MariaDB on Rocky Linux 8

Step 1. First, before you start installing any package on your Rocky Linux server, we always recommend making sure that all system packages are updated.

sudo dnf update
sudo dnf upgrade

Step 2. Install MariaDB on Rocky Linux.

Installing MariaDB on your Rocky Linux system is straightforward, Now add MariaDB’s official repository to the latest version:

sudo nano /etc/yum.repos.d/mariadb.repo

Add the following lines:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.6/rhel8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Next, update the system repositories and install the MariaDB server and client using the following command:

sudo dnf update
sudo dnf install mariadb-server mariadb

After installed, enable MariaDB service to start on boot time and start the service using the following commands:

sudo systemctl enable mariadb
sudo systemctl start mariadb

Step 3. Secure MariaDB Server

MariaDB comes with a default security script, mysql_secure_installationthat is used to improve the security of MariaDB installation by:

  • Setting the password for root accounts (if need be).
  • Disabling remote root login to the databases.
  • Removing anonymous-user accounts.
  • Removing the test database, which by default can be accessed by anonymous users.

Now, to secure MariaDB, execute the below-mentioned command:

sudo mysql_secure_installation

Install MariaDB on Rocky Linux 8

Now to verify the security we will run the following command to enter the environment of MariaDB and then type the set password to access it:

sudo mysql -u root -p

That’s all you need to do to install MariaDB on Rocky Linux 8. I hope you find this quick tip helpful. For further reading on the MariaDB database server, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.