MariaDB is a popular open-source relational database management system that is widely used for its performance, scalability, and robust feature set. Installing MariaDB 11.5.1 on Rocky Linux 8.10 is a straightforward process. In this guide, we will walk you through the steps needed to get MariaDB up and running on your system.
Prerequisites
Before we start, make sure you have:
- A Rocky Linux 8.10 server.
- Root or sudo access to your server.
- A stable internet connection.
Step 1: Update Your System
Before installing any new software, it’s always a good idea to update your system to ensure you have the latest packages and security patches.
$ sudo dnf update -y
Step 2: Add the MariaDB Repository
MariaDB is not included in the default Rocky Linux repositories, so you need to add the MariaDB repository to your system.
First, create a new repo file for MariaDB:
$ sudo nano /etc/yum.repos.d/MariaDB.repo
Add the following content to the file:
# MariaDB 11.5.1 CentOS repository list - created 2024-06-17 10:00 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/11.5.1/centos8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Save and close the file by pressing Ctrl + X
, then Y
, and Enter
.
Step 3: Install MariaDB
With the repository added, you can now install MariaDB using the dnf
package manager.
bashCopy codesudo dnf install MariaDB-server MariaDB-client -y
$ sudo dnf install MariaDB-server MariaDB-client -y
Step 4: Start and Enable MariaDB
After installation, start the MariaDB service and enable it to start on boot.
$ sudo systemctl start mariadb
$ sudo systemctl enable mariadb
You can verify that MariaDB is running with the following command:
$ sudo systemctl status mariadb
Step 5: Secure the MariaDB Installation
MariaDB includes a security script to improve the security of your installation. Run the script to set the root password, remove anonymous users, disallow remote root login, and remove the test database.
$ sudo mysql_secure_installation
You will be prompted to enter the current root password, which is blank by default. Just press Enter
. Then follow the prompts to set a root password and answer Y
(yes) to all the subsequent questions.
Step 6: Verify the Installation
To verify that MariaDB is installed and working correctly, log in to the MariaDB shell using the root user.
$ sudo mysql -u root -p
Enter the root password you set earlier. If you successfully log in, you should see the MariaDB shell prompt:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 11.5.1-MariaDB MariaDB Server
You can also check the MariaDB version:
SELECT VERSION();
This should return 11.5.1
.
Step 7: Create a Database (Optional)
To create a new database and user, you can use the following commands within the MariaDB shell:
CREATE DATABASE mydatabase;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
Replace mydatabase
, myuser
, and mypassword
with your desired database name, username, and password.
Conclusion
You have successfully installed MariaDB 11.5.1 on Rocky Linux 8.10. MariaDB is now ready to use for your applications. For more advanced configurations and optimizations, refer to the official MariaDB documentation.
By following these steps, you ensure that your database setup is secure and ready for production use.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.