Table of Contents[Hide][Show]
MariaDB is a powerful, open-source relational database management system (RDBMS) that serves as a drop-in replacement for MySQL. It is widely used for its performance, scalability, and security features. If you are running Red Hat Enterprise Linux (RHEL) and need a reliable database solution, MariaDB is an excellent choice.
In this guide, we will walk you through How to Install MariaDB on RHEL, covering the essential steps to set up, configure, and secure your database server. Whether you are a beginner or an experienced user, this tutorial will help you get MariaDB up and running smoothly on your RHEL system.
Why Choose MariaDB?
MySQL has long been a leading relational database management system (RDBMS), widely adopted by developers globally. However, in 2008, MySQL was acquired by Sun Microsystems, which was later bought by Oracle Corporation. This shift in ownership raised concerns about MySQL’s future as an open-source project, as Oracle’s stewardship moved it away from its fully open-source roots.
This is where MariaDB comes in. MariaDB is a community-driven, open-source RDBMS, forked from MySQL by its original co-founder, Michael “Monty” Widenius, along with other core developers and community contributors. Backed by Monty Program AB and the MariaDB Foundation, MariaDB is committed to maintaining its independence, transparency, and true open-source nature.
Michael “Monty” Widenius, along with David Axmark and Allan Larsson, originally developed MySQL. Following Oracle’s acquisition, Monty established Monty Program AB, which now plays a central role in MariaDB’s development. The MariaDB Foundation oversees the project, ensuring it stays free, open, and responsive to user needs.
Key Reasons to Use MariaDB:
- Truly Open Source: MariaDB is licensed under open-source terms, guaranteeing transparency, community participation, and freedom from vendor lock-in.
- Developed by MySQL’s Creators: With Monty Widenius and other MySQL pioneers at the helm, MariaDB benefits from their extensive expertise and dedication to innovation.
- Superior Features and Performance: MariaDB offers significant enhancements over MySQL, including improved performance, additional storage engines, and advanced functionalities.
- Seamless MySQL Compatibility: MariaDB is fully compatible with MySQL, allowing for effortless migration of existing MySQL applications with minimal adjustments.
- Strong Community and Foundation Support: The MariaDB Foundation ensures the project remains community-focused and aligned with user requirements.
In summary, MariaDB provides a robust, high-performance, and genuinely open-source alternative to MySQL, supported by its original creators and a thriving community. Whether you seek advanced features, better performance, or a commitment to open-source values, MariaDB is an outstanding choice for your database needs.
Who Uses MariaDB?
MariaDB has become a popular choice for a wide range of organizations, distributions, and large-scale websites, thanks to its reliability, performance, and open-source foundation. Many well-known companies and projects have adopted MariaDB, taking advantage of its advanced features and seamless compatibility with MySQL. Below are some notable users of MariaDB:
Here’s the organized table:
Websites and Platforms | Linux Distributions | Other Organizations |
---|---|---|
OpenSUSE | OLX | |
Amazon Web Services (AWS) | Fedora | Nimbuzz |
Arch Linux | SlashGear | |
Mozilla Corporation | Red Hat Enterprise Linux (RHEL 7+) | |
Wikipedia | Manjaro | |
Mageia | ||
Debian | ||
The Chakra Project | ||
Gentoo | ||
OpenBSD |
These organizations and distributions have embraced MariaDB for its superior performance, scalability, and strong community support. Its compatibility with MySQL makes it an ideal choice for those transitioning from MySQL while retaining stability and gaining access to cutting-edge features. Whether it’s driving large-scale web applications or serving as the default database for Linux distributions, MariaDB remains a trusted and versatile solution across industries.
Prerequisites
Before you begin the installation process, ensure that your system meets the following requirements:
- Operating System: Your host system must be running Red Hat Enterprise Linux (RHEL) 7 or CentOS 7.
- Root Access: You must have root or sudo privileges to install packages and configure the system.
- Internet Connection: Your system should have an active internet connection to download the necessary packages.
How to Install MariaDB on RHEL: 7 Easy Steps
Step 1: Log in as Root
To install MariaDB, you need to log in as the root user or use a user account with sudo privileges. Open your terminal and log in as root:
login as: root
root@linuxnutshell password:
Last login: Fri Jan 8 21:33:00 2017 from host.domain.com
Step 2: Install MariaDB Server
Once logged in as root, you can proceed to install the MariaDB server. The yum
package manager is used to install software on RHEL and CentOS systems. To install MariaDB, run the following command:
[root@linuxnutshell ~]# yum install mariadb-server.x86_64
This command will initiate the installation process. The system will resolve dependencies and prompt you to confirm the installation. Here’s an example of what you might see:
Loaded plugins: fastestmirror, langpacks ... ... ======================================================================================= Package Arch Version Repository Size ======================================================================================= Installing: mariadb-server x86_64 1:5.5.56-2.el7 base 11 M Installing for dependencies: Transaction Summary ======================================================================================= Install 1 Package (+8 Dependent packages) Upgrade ( 1 Dependent package) Total download size: 22 M Is this ok [y/d/N]: y
Press y
and then Enter
to proceed with the installation. The system will download and install the MariaDB server along with any required dependencies.
Step 3: Start MariaDB Server
After the installation is complete, you need to start the MariaDB service. Use the systemctl
command to start the service:
[root@linuxnutshell ~]# systemctl start mariadb
To verify that the MariaDB server has started successfully, check its status:
[root@linuxnutshell ~]# systemctl status mariadb
You should see output similar to the following:
mariadb.service - MariaDB database server
...
Nov 08 21:28:59 linuxnutshell systemd[1]: Starting MariaDB database server...
...
Nov 08 21:29:01 scspr0523972001 systemd[1]: Started MariaDB database server.
This indicates that the MariaDB server is up and running.
Step 4: Enable MariaDB to Start on Boot
To ensure that MariaDB starts automatically whenever the system reboots, enable the service using the following command:
[root@linuxnutshell ~]# systemctl enable mariadb
This command creates a symbolic link to the MariaDB service in the appropriate systemd directory, ensuring that the service is started automatically at boot time.
Step 5: Secure MariaDB Installation
MariaDB comes with a script called mysql_secure_installation
that helps you secure the database server. This script allows you to set a root password, remove anonymous users, disallow remote root login, and remove the test database. Run the script by executing the following command:
[root@linuxnutshell ~]# mysql_secure_installation
The script will prompt you with several questions. Here’s a breakdown of the prompts and recommended actions:
- Set root password: It is highly recommended to set a strong password for the root user. Enter
y
and provide a secure password.Set root password? [Y/n] y New password: Re-enter new password: Password updated successfully!
- Remove anonymous users: Anonymous users can pose a security risk. Remove them by entering
y
.Remove anonymous users? [Y/n] y ... Success!
- Disallow root login remotely: Restricting root login to localhost enhances security. Enter
y
to disallow remote root login.Disallow root login remotely? [Y/n] y ... Success!
- Remove test database: The test database is not needed in a production environment. Remove it by entering
y
.Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success!
- Reload privilege tables: Finally, reload the privilege tables to apply the changes.
Reload privilege tables now? [Y/n] y ... Success!
After completing these steps, your MariaDB installation will be more secure.
Step 6: Verify MariaDB Installation
To ensure that MariaDB is installed and functioning correctly, you can log in to the MariaDB shell using the root user and the password you set during the secure installation process:
[root@linuxnutshell ~]# mysql -u root -p
Enter your root password when prompted. If the login is successful, you will see the MariaDB prompt:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 5.5.56-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
You can now execute SQL commands and manage your databases.
Step 7: Configure MariaDB (Optional)
Depending on your use case, you may need to configure MariaDB further. The main configuration file for MariaDB is located at /etc/my.cnf
. You can edit this file to adjust settings such as memory allocation, storage engines, and networking options.
For example, to increase the maximum number of connections, you can add the following line under the [mysqld]
section:
max_connections = 500
After making changes to the configuration file, restart the MariaDB service to apply the changes:
[root@linuxnutshell ~]# systemctl restart mariadb
Conclusion
In this guide, we have covered how to install MariaDB on RHEL 7 or CentOS 7. We started by installing the MariaDB server using the yum
package manager, then proceeded to start and enable the MariaDB service. We also secured the installation using the mysql_secure_installation
script and verified that the installation was successful by logging in to the MariaDB shell.
By following these steps, you should now have a fully functional and secure MariaDB server running on your RHEL system. Whether you are setting up a new database server or migrating from MySQL, MariaDB offers a robust and reliable solution for your database needs.
Remember to regularly update your MariaDB installation to benefit from the latest features and security patches. You can do this by running the following command:
[root@linuxnutshell ~]# yum update mariadb-server
With MariaDB installed and configured, you are now ready to start building and managing your databases on RHEL. Happy querying!