Search

Your Guide on How to Install Mariadb Rocky Linux 9

Welcome to our installation guide for Mariadb on Rocky Linux 9. If you are looking for a step-by-step tutorial on how to install Mariadb, you've come to the right place. In this article, we will walk you through the process of installing Mariadb on Rocky Linux 9, ensuring that you have all the necessary information to successfully set up and configure your database system.

Whether you are a beginner or an experienced user, this installation guide will provide you with all the instructions you need to get Mariadb up and running on your Rocky Linux 9 system. We will cover the prerequisites, the installation process, and even guide you on creating a new database and user in Mariadb.

So, if you're ready to dive in and learn how to install Mariadb on Rocky Linux 9, let's get started!

Prerequisites for Installing Mariadb on Rocky Linux 9

Before you can install Mariadb on Rocky Linux 9, there are a few prerequisites that you need to ensure are met. Here are the key requirements:

  1. A Rocky Linux 9 system with root or sudo access: Make sure you have administrative privileges on your system to install and configure software.
  2. Up-to-date system: Before installing Mariadb, it's recommended to update your system to ensure you have the latest software updates and bug fixes. You can do this by running the command "sudo dnf update".

Having a basic understanding of Mariadb-server databases and being comfortable with command-line editors will also be helpful during the installation process.

By meeting these prerequisites, you'll be well-prepared to proceed with the installation of Mariadb on Rocky Linux 9.

Installing Mariadb on Rocky Linux 9

In order to install Mariadb on Rocky Linux 9, you can follow these step-by-step instructions:

  1. Open your terminal and enter the command sudo dnf install mariadb-server to begin the installation process.
  2. Once the installation is complete, start the Mariadb service by running the command sudo systemctl start mariadb.
  3. To ensure that Mariadb starts automatically at boot, enable the service by typing sudo systemctl enable mariadb.
  4. To verify the status of the Mariadb service, use the command sudo systemctl status mariadb. This will display information about the service and confirm that it is running properly.
  5. To secure your Mariadb installation, run the command sudo mysql_secure_installation. This will guide you through a series of prompts to set a root password, remove anonymous users, and perform other security configurations.

Following these steps will ensure that Mariadb is successfully installed on your Rocky Linux 9 system. By securing your installation and enabling the service to start automatically, you can begin using Mariadb for your databases.

Now that you have completed the installation of Mariadb, you can proceed to create a new database and user. This will allow you to start using Mariadb for your projects and applications.

Let's move on to the next section to learn how to create a new database and user in Mariadb.

Creating a New Database and User in Mariadb

To fully leverage the capabilities of Mariadb on your Rocky Linux 9 system, it's essential to learn how to create a new database and user. This allows you to organize your data effectively and manage access permissions securely.

To create a new database, log in to Mariadb as the root user in your terminal or command prompt. Use the command CREATE DATABASE mydatabase; to create the database, replacing "mydatabase" with the desired name for your database.

Once the database is created, you can create a new user with specific access privileges. Use the command CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; to create a user named "myuser" with a password of "mypassword". Substitute these values with your chosen username and password.

Next, grant all privileges to the user for the newly created database using the command GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';. This grants the user full access to the database. Finally, run FLUSH PRIVILEGES; to ensure the changes take effect immediately.

You can verify the successful creation of the database and user by logging in with the new credentials. Use the command mysql -u myuser -p and enter the password when prompted. You will now have access to the database, where you can begin managing and manipulating your data.

Conclusion

By following this guide, you have successfully installed Mariadb on Rocky Linux 9. With Mariadb, you now have a powerful and reliable database system for your web applications and services. The installation process was straightforward, and you have secured your Mariadb installation by setting a root password and removing anonymous users.

In addition to the installation, you have also learned how to create a new database and user in Mariadb. This allows you to organize and manage your data effectively. By granting privileges to the user, you can control access to the database and ensure data security.

Overall, Mariadb on Rocky Linux 9 provides a robust and efficient environment for your database needs. Whether you are a developer, a sysadmin, or managing web services, Mariadb offers the features and performance you require. With the knowledge gained from this guide, you are well-equipped to build and maintain databases on Rocky Linux 9 with Mariadb.

Sys Admin

Sys Admin

I am a Red Hat Certified Engineer (RHCE) and working as an IT Professional since 2012...