Learn how to install MariaDB on Rocky Linux 8 with our straightforward guide. Follow step-by-step instructions to set up this MySQL fork, a powerful and reliable open-source relational database management system, on your Linux server. #centlinux #linux #mysql
Table of Contents
What is MariaDB?
MariaDB is an open-source relational database management system (RDBMS) and a drop-in replacement for MySQL. It was created by the original developers of MySQL due to concerns over Oracle’s acquisition of MySQL AB. MariaDB retains compatibility with MySQL while offering additional features, performance improvements, and enhanced security. (MariaDB Official Website)
Key features of MariaDB include:
- Compatibility: MariaDB maintains compatibility with MySQL, ensuring that existing MySQL applications can easily transition to MariaDB without modification.
- Performance: MariaDB includes optimizations and enhancements that can improve database performance compared to MySQL, such as a new storage engine (Aria) and thread pooling.
- High Availability: MariaDB offers features like replication, clustering, and automatic failover to ensure high availability and reliability of database services.
- Security: MariaDB includes security enhancements such as database encryption, role-based access control (RBAC), and improved authentication mechanisms to protect data integrity and confidentiality.
- Scalability: MariaDB supports scalability through features like parallel replication, sharding, and multi-master replication, allowing it to handle large-scale deployments and high-volume workloads.
- Community-driven Development: MariaDB is developed and maintained by a vibrant community of contributors, ensuring ongoing development, support, and innovation.
Read Also: MySQL Cheat Sheet: DBA Edition 2025
Overall, MariaDB is a powerful and feature-rich alternative to MySQL, suitable for a wide range of applications from small-scale projects to large-scale enterprise deployments.

MariaDB vs MySQL: Key Differences
Both MariaDB and MySQL are popular relational databases, but they differ in licensing, performance, and community support. Here’s a simplified comparison:
1. Origins & Licensing
- MySQL: Owned by Oracle, offering both open-source (GPL) and proprietary versions. Some users worry about Oracle’s control.
- MariaDB: A fork of MySQL created by its original developers. Fully open-source (GPL) with no proprietary restrictions.
Key Point: MariaDB is more community-driven, while MySQL has corporate backing.
2. Performance & Features
- MySQL: Stable and reliable, with strong enterprise support. Uses InnoDB as the default storage engine.
- MariaDB: Often faster in benchmarks, with extra engines like Aria, ColumnStore, and RocksDB. Supports Galera Cluster for multi-master replication.
Key Point: MariaDB offers more features and better performance in some cases, while MySQL focuses on stability.
3. Security & Updates
- MySQL: Enterprise users get advanced security features, but community updates may lag.
- MariaDB: More frequent open-source security patches and built-in encryption options.
Key Point: MariaDB is often preferred for security-conscious open-source projects.
4. Which One Should You Use?
- Choose MySQL if: You need Oracle’s enterprise support or work with legacy systems.
- Choose MariaDB if: You want better performance, more features, and full open-source freedom.
Final Verdict:
- For most new projects → MariaDB (faster, more features).
- For corporate environments → MySQL (enterprise support).
Environment Specification
We are using a minimal Rocky Linux 8 virtual machine with following specifications.
- CPU – 3.4 Ghz (2 cores)
- Memory – 2 GB
- Storage – 20 GB
- Operating System – Rocky Linux 8.5 (Green Obsidian)
- Hostname – mariadb-01.centlinux.com
- IP Address – 192.168.116.128 /24
For testing and experimenting with MariaDB on Rocky Linux 8, using a dedicated environment is highly recommended. A Mini PC offers a compact, energy-efficient physical server ideal for hands-on experience with Linux server administration in a home lab setup.
[Grab a Mini PC for your Home Lab – Shop with Us!]
Alternatively, a reliable VPS like Hostinger’s VPS provides scalable resources and easy remote access, perfect for running MariaDB without the need for local hardware.
[Get Reliable VPS Hosting at Affordable Prices – Sign Up Now!]
Both options offer excellent platforms to practice and deploy your Linux server projects effectively. If you decide to explore either option, consider the Mini PC or Hostinger VPS links above to get started with your own home lab environment.
Disclaimer: This post contains affiliate links. If you choose to purchase through these links, we may earn a small commission at no extra cost to you. This helps support our blog and allows us to continue providing detailed Linux tutorials.
Update Your Rocky Linux Server
By using a SSH client, connect with your Linux server as root user.
Build yum cache of installed repositories.
dnf makecacheExecute following command to update software packages in your Linux server.
dnf update -yCheck the Linux Operating System and Kernel versions as follows.
cat /etc/rocky-release && uname -rOutput:
Rocky Linux release 8.5 (Green Obsidian)
4.18.0-348.20.1.el8_5.x86_64
Ear and Nose Hair Trimmer Clipper – 2025 Professional Painless Eyebrow & Facial Hair Trimmer for Men Women, Battery-Operated Trimmer with IPX7 Waterproof, Dual Edge Blades for Easy Cleansing Black
27% OffInstall MariaDB on Rocky Linux 8
Get the list of MariaDB modules, that are available in standard yum repositories.
dnf module list mariadbOutput:
Last metadata expiration check: 0:02:47 ago on Mon 04 Apr 2022 08:05:18 PM PKT.
Rocky Linux 8 - AppStream
Name Stream Profiles Summary
mariadb 10.3 [d] client, galera, server [d] MariaDB Module
mariadb 10.5 client, galera, server [d] MariaDB Module
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
You can see that, our required MariaDB Server 10.8 is not available in Rocky Linux yum repositories.
Therefore, you have to install MariaDB Official Repository on your Linux server.
Visit MariaDB Official website and select your Linux operating system to generate a yum repo for your machine.

Create a yum repo file by using vim text editor.
vi /etc/yum.repos.d/MariaDB.repoCopy and paste the generated yum repo into this file.
# MariaDB 10.8 [RC] CentOS repository list - created 2022-04-04 14:48 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://mirrors.gigenet.com/mariadb/yum/10.8/centos8-amd64
module_hotfixes=1
gpgkey=https://mirrors.gigenet.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1Save and exit.
Build cache for newly installed yum repositories.
dnf makecacheOutput:
MariaDB 57 kB/s | 201 kB 00:03
Rocky Linux 8 - AppStream 3.5 kB/s | 4.8 kB 00:01
Rocky Linux 8 - BaseOS 2.3 kB/s | 4.3 kB 00:01
Rocky Linux 8 - Extras 2.6 kB/s | 3.5 kB 00:01
Metadata cache created.
Now you can install MariaDB on Rocky Linux by executing following Linux command.
dnf install -y mariadb-serverEnable and start MariaDB Service.
systemctl enable --now mariadb.serviceCheck the status of MariaDB service.
systemctl status mariadb.serviceOutput:
● mariadb.service - MariaDB 10.8.2 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor pre>
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Mon 2022-04-04 20:18:03 PKT; 10min ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 4728 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 8 (limit: 5808)
Memory: 261.1M
CGroup: /system.slice/mariadb.service
└─4728 /usr/sbin/mariadbd
Apr 04 20:18:03 mariadb-01.centlinux.com mariadbd[4728]: 2022-04-04 20:18:03 0 >
Apr 04 20:18:03 mariadb-01.centlinux.com mariadbd[4728]: 2022-04-04 20:18:03 0 >
Apr 04 20:18:03 mariadb-01.centlinux.com mariadbd[4728]: Version: '10.8.2-Maria>
Configure initial settings of your MariaDB server.
mariadb-secure-installationOutput:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Connect to your MariaDB Server by using mysql command.
mysql -u root -pDisplay list of available databases.
show databases;Output:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.071 sec)
You have successfully install MariaDB on Rocky Linux operating system.
Configure Linux Firewall
If you plan to access your MariaDB database server from network, then you have enable the MariaDB service in your Linux Firewall.
firewall-cmd --permanent --add-service=mysql
firewall-cmd --reloadTayasui Sketches
$4.90 (as of October 30, 2025 20:42 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Frequently Asked Questions (FAQs)
1. What is the easiest way to install MariaDB on Rocky Linux 8?
Use dnf to install MariaDB and start it automatically:
sudo dnf install mariadb-server mariadb -y
sudo systemctl enable --now mariadb 2. How do I check if MariaDB is running properly?
Verify the service status with:
sudo systemctl status mariadb (If active, you should see active (running) in green.)
3. How do I set a root password for MariaDB?
Run the security script and follow the prompts:
sudo mysql_secure_installation (You’ll be asked to set a password, remove anonymous users, disable remote root login, and more.)
4. How do I create a new MariaDB user and database?
Log in to MariaDB (sudo mysql -u root -p), then run:
CREATE DATABASE mydb;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES; 5. How do I allow remote connections to MariaDB?
Edit /etc/my.cnf.d/mariadb-server.cnf and add:
[mysqld]
bind-address = 0.0.0.0 Restart MariaDB (sudo systemctl restart mariadb) and configure the firewall.
Read Also: How to Install MariaDB on AlmaLinux 10
Final Thoughts
Installing MariaDB on Rocky Linux 8 provides you with a robust and reliable open-source database management system for your server. With our comprehensive guide, you can easily set up MariaDB and leverage its powerful features to manage your data effectively.
Your Linux servers deserve expert care! I provide reliable management and optimization services tailored to your needs. Discover how I can help!
Recommended Courses
If you’re serious about mastering databases and boosting your tech career, The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert by Colt Steele is one of the most practical and highly-rated online courses available. Designed for both beginners and professionals, this course walks you step-by-step from the fundamentals of SQL to advanced database management skills using real-world examples.
Whether you’re a developer, data analyst, or aspiring system administrator, this bootcamp will give you the confidence to work with MySQL like a pro. [Enroll today] and start building skills that employers value.
Disclaimer: This post contains affiliate links. If you purchase through these links, I may earn a small commission at no additional cost to you.

Leave a Reply
Please log in to post a comment.