Learn how to install MariaDB on CentOS 7 with this step-by-step guide. Follow our easy instructions to set up your database server, ensuring a smooth and successful installation process. #centlinux #linux #mysql
Table of Contents
What is MariaDB?
MariaDB is a famous fork of MySQL relational database management system. Just like it predecessor MariaDB is also free and open source under the GNU GPL license. MariaDB is community-developed and commercially supported. MariaDB is developed by some of the original developers of MySQL.
Since, it’s initial fork from MySQL, MariaDB has been enhanced with many new features. Currently, it’s stable version 10.3.12 is available to use.
MariaDB is a popular open-source relational database management system (RDBMS) that serves as a drop-in replacement for MySQL. Developed by the original creators of MySQL after Oracle Corporation’s acquisition of MySQL, MariaDB is designed to be a robust, high-performance, and fully-featured database solution.

Here’s a comprehensive overview of MariaDB:
Key Features of MariaDB
- Open Source:
- License: MariaDB is released under the GNU General Public License, making it free to use, distribute, and modify. Its open-source nature promotes transparency and community-driven development.
- Compatibility:
- MySQL Drop-In Replacement: MariaDB is designed to be highly compatible with MySQL, meaning most applications and tools developed for MySQL will work seamlessly with MariaDB with minimal or no changes.
- APIs and Commands: It supports the same APIs, commands, and connectors as MySQL, ensuring a smooth transition for users migrating from MySQL.
- Performance Enhancements:
- Optimized Queries: MariaDB includes optimizations for query performance, such as advanced indexing and query execution improvements.
- Storage Engines: Features storage engines like InnoDB, MyISAM, and new engines like Aria and TokuDB for improved performance and features.
- Advanced Features:
- Replication: Supports master-slave replication, multi-master replication, and group replication for high availability and scaling.
- Galera Cluster: Includes built-in support for Galera Cluster, enabling synchronous multi-master replication for high availability and fault tolerance.
- Security:
- Enhanced Security: Offers features such as role-based access control, user authentication improvements, and data encryption.
- Audit Plugins: Provides auditing capabilities to track database activities and ensure compliance.
- Scalability:
- Horizontal Scaling: Supports sharding and clustering to manage large volumes of data and high traffic loads.
- High Availability: Tools and features to create redundant setups and ensure continuous database operation.
- Community-Driven Development:
- MariaDB Foundation: Governed by the MariaDB Foundation, which oversees the development and ensures that it remains open source and community-focused.
- Tools and Integrations:
- Management Tools: Offers tools like MariaDB Monitor, MariaDB MaxScale, and MariaDB Galera Manager for easier database management and administration.
- Integrations: Works with various third-party tools for backup, monitoring, and data analysis.
Common Use Cases for MariaDB
- Web Applications:
- Content Management Systems: Widely used with CMS platforms like WordPress, Joomla, and Drupal.
- E-commerce Platforms: Powers e-commerce sites with robust data management and performance.
- Enterprise Solutions:
- Business Applications: Supports critical enterprise applications requiring high performance and reliability.
- Data Warehousing and Analytics:
- Reporting and Analysis: Used for data warehousing solutions and business intelligence applications.
- Development and Testing:
- Software Development: Commonly used in development and testing environments for database-driven applications.
Recommended Training: The Ultimate MySQL Bootcamp: Go from SQL Beginner to Expert from Colt Steele

MariaDB Server Specification
We have a virtual machine with following specifications:
- Hostname – mariadb-01.example.com
- IP Address – 192.168.116.130/24
- Operating System – CentOS 7.6
- MariaDB Server – 10.3.12
Apple 2025 MacBook Air 13-inch Laptop with M4 chip: Built for Apple Intelligence, 13.6-inch Liquid Retina Display, 16GB Unified Memory, 512GB SSD Storage, 12MP Center Stage Camera, Touch ID; Sky Blue
$1,049.00 (as of May 17, 2025 16:11 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.)Install MariaDB on CentOS 7
Connect to mariadb-01.example.com using ssh.
MariaDB packages are available through standard yum repositories. However, we are installing MariaDB 10.3.12 (latest stable version while writing this article) therefore, we have to either download its tarball from MariaDB Downloads or we can add the MariaDB yum repository.
Read Also: Setup MariaDB Database Server on Rocky Linux 9

We are installing MariaDB yum repository as follows.
vi /etc/yum.repos.d/mariadb.repo
Add following directives therein.
[mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
enabled=1
Before using MariaDB yum repository, we must import the GPG public key to verify the digital signatures of the packages in this repository.
Although, it is not necessary to import the GPG public key manually. The GPG public key will be automatically installed by yum, when we install a package from MariaDB yum repository for the first time.
Here, we are importing the GPG public key manually for the sake of demonstration.
rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Build yum cache using following command.
yum makecache fast
Output:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.ges.net.pk
* extras: mirrors.ges.net.pk
* updates: mirrors.ges.net.pk
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
mariadb | 2.9 kB 00:00
updates | 3.4 kB 00:00
mariadb/primary_db | 50 kB 00:01
Metadata Cache Created
Install MariaDB server using yum command.
yum install -y mariadb-server
Start and enable MariaDB service.
systemctl start mariadb
systemctl enable mariadb
MariaDB Initial Configuration
Configure MariaDB database instance.
mysql_secure_installation
Output:
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
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
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!
Accessing MariaDB Server
Login to MariaDB database server.
mysql -u root -p
Display list of available databases.
show databases;
Output:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)
MariaDB 10.3 server has been installed on CentOS 7.
Frequently Asked Questions (FAQs)
What is MariaDB?
MariaDB is a popular open-source relational database management system (RDBMS), created as a fork of MySQL. It is widely used for storing and managing data.
Do I need to uninstall MySQL before installing MariaDB?
Yes, if MySQL is already installed, it’s recommended to remove it first to avoid conflicts, as MariaDB is designed to be a drop-in replacement.
How do I start and enable MariaDB after installation?
After installation, you can start the MariaDB service and set it to launch automatically at system boot using system management commands.
How do I secure MariaDB after installation?
MariaDB includes a security script that helps you set a root password, remove anonymous users, disable remote root login, and remove test databases.
How can I check if MariaDB is running properly?
You can verify the MariaDB service status and test the connection by logging into the MariaDB shell with the root credentials.
Site Reliability Engineering: How Google Runs Production Systems
$24.77 (as of May 17, 2025 16:11 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.)Final Thoughts
Installing MariaDB on CentOS 7 is a fundamental step toward setting up a reliable and high-performance relational database system. By enabling the appropriate repository, installing the MariaDB server package, starting the service, and securing the installation, you now have a fully functional database ready for use.
To ensure long-term stability and security, keep the system updated, monitor database performance, and follow best practices for user and permission management.
Need expert AWS and Linux system administration? From cloud architecture to server optimization, I provide reliable and efficient solutions tailored to your needs. Hire me on Fiverr today!
Get your MariaDB server set up efficiently with professional support today!
Leave a Reply
You must be logged in to post a comment.