Home // How to Install MariaDB on CentOS 8
0 4 minutes read
| Published on: February 22, 2023 | Last updated on: July 23, 2023

In this tutorial, we will explain how to install and secure MariaDB 10.3 on CentOS 8/Rocky.

MariaDB is a free and open-source relational database management system (RDBMS) that can be used as a drop-in replacement for MySQL. Many people in the community, including some of MySQL’s original creators, work on it.

Installing MariaDB on CentOS 8/Rocky

The latest stable release of MariaDB for CentOS 8/Rocky can be found as version 10.3 in the official repositories.

MariaDB 10.3 for CentOS 8/Rocky can be installed by running the following command as root or a user with sudo privileges:

sudo dnf install @mariadb

Using the @mariadb module, MariaDB server and all required components are set up.

Once everything is set up, you can start the MariaDB service and have it start automatically at boot time by typing:

sudo systemctl enable --now mariadb

In order to ensure that MariaDB is up and running, type:

sudo systemctl status mariadb

The results should demonstrate that the service has been activated:

● mariadb.service - MariaDB 10.3 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2019-12-08 21:05:26 UTC; 15s ago
   ..

Securing MariaDB

Mysql secure installation, a script included in the MariaDB server package, sets the root password and performs several other security-related tasks.

Type the following to activate the script:

sudo mysql_secure_installation

The MariaDB root user requires a password, which you will be prompted to create. After that, the script will request that you delete the test database, disable the anonymous user, and limit root access to the local machine. Every question needs to be answered with a “Y” (yes).

Now that MariaDB is up and running on your CentOS server, you can begin using it.

Connect to the MariaDB Shell

In order to log in to the MariaDB server as the root user, enter:

mysql -u root -p

When prompted, enter the root password to access the MariaDB shell:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.11-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> 

Conclusion

We’ve covered everything from downloading MariaDB to securing it during installation on CentOS 8/Rocky, plus command line access to the server itself.

It’s time to start making use of your MariaDB server now that you’ve established shell access to it and can begin making new databases and users.

MySQL 8.0 is included with CentOS 8/Rocky. Check out the How to Install MySQL on CentOS 8/Rocky manual if you’d rather set up MySQL than MariaDB. Remember that MariaDB and MySQL cannot coexist on the same server.

Feel free to leave a comment below with any questions, thoughts, or suggestions.

IF YOU ARE HAVING PROBLEMS WITH THIS GUIDE, EMAIL US AT:

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

Copyright @2022-2024 All Right Reserved – PCPlanet

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. You understand and give your consent that your IP address and browser information might be processed by the security plugins installed on this site. By clicking “Accept”, you consent to the use of ALL the cookies.
.
Accept Read More

Privacy & Cookies Policy