MariaDB was created after MySQL acquired by Oracle on 2009. It became the best alternate option for MySQL user due to the similarity with MySQL. This post will describe how to install MariaDB on CentOS 8.
Prerequisites
CentOS 8 with root user or sudo user access.
Install MariaDB
- Run this command to install the MariaDB
sudo dnf install mariadb-server
- Run this command to start MariaDB service
sudo systemctl start mariadb
- Run this command to check MariaDB service’s status
sudo systemctl status mariadb
You should see output like this
- Run this command to start MariaDB service on boot
sudo systemctl enable mariadb
Securing MariaDB Installation
MariaDB has been installed but no security has been set. This step will describe how to secure the MariaDB installation.
- Run this command to start the script
sudo mysql_secure_installation
- The script will start the installation and it will guide you to complete the installation. Below are some guidance for you to complete the installation.
- Enter current password for root (enter for none). Just hit enter on this step because we haven’t set the root password yet.
- Set root password? Y
- New Password. Enter the password for the root account of the MariaDB.
- Re-enter new password.
- Remove anonymous users? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
That’s it, now you can login to the MariaDB using this command.
sudo mysql -p
Use the root password to login. Then you can list the database to test the installation using this query.
show databases;
Hi, my name is Wie Siang
This blog was created to share my experience as a software engineer.
"Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time."
-Thomas Alva Edison-