HOSTING100
← Back to Blog

How to install MariaDB on CentOS 8

How to install MariaDB on CentOS 8

MariaDB is a free and open-source relational database management system (RDBMS). It’s designed to be a drop-in replacement for MySQL, another popular RDBMS. Here’s a breakdown of what that means:

Here are some key features of MariaDB:

Overall, MariaDB is a powerful and versatile option for anyone needing a free and open-source relational database solution.

Here’s how to install MariaDB on CentOS 8:

1. Update your system:

Before you begin, ensure your system is up-to-date using the following command:

sudo dnf update

2. Install MariaDB:

Use the following command to install MariaDB and its dependencies:

sudo dnf install @mariadb

3. Start and enable MariaDB service:

Enable and start the MariaDB service with these commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

4. Secure MariaDB:

MariaDB security:

The MariaDB server package performs several security-related operations and sets the master password with a script called mysql_secure_installation. Verify the script by typing the following command:

sudo mysql_secure_installation

You will be prompted to set a password for the MariaDB root user. After doing this, the script will also ask you to remove the anonymous user, restrict root access to the local machine, and remove the test database. You must answer “yes” “Y” to all questions. You have installed and secured MariaDB on your CentOS server and are ready to use it.

5. Verify the installation:

To confirm MariaDB is installed and running correctly, use the following command:

sudo systemctl status mariadb

The output should show the service is “active (running)”.

6. Connect to MariaDB:

Finally, you can connect to the MariaDB shell as the root user using:

sudo mysql -u root -p

When prompted for the password, enter the one you set in step 4.

Additional Tips:

Conclusion :

In this tutorial, we showed you how to install and secure MariaDB on CentOS 8 and how to connect to the MariaDB server from the command line. Now that your MariaDB server is up and running, you can connect to the MariaDB shell and start creating new databases and users.