Install MariaDB on CentOS 7: Step-by-Step Guide

To install and configure MariaDB database on CentOS7, follow the steps below:

  1. Update the system software packages.
sudo yum update
  1. Install the MariaDB database:
sudo yum install mariadb-server
  1. Start the MariaDB service and set it to start automatically at boot.
sudo systemctl start mariadb
sudo systemctl enable mariadb
  1. Run a security script to enhance database security and set up a password as instructed.
sudo mysql_secure_installation
  1. Access the MariaDB database:
sudo mysql -u root -p
  1. Create new users and databases in MariaDB.
CREATE DATABASE dbname;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
  1. Exit MariaDB database and log back in to verify if the new user and database have been successfully created.
exit
sudo mysql -u username -p
USE dbname;

You have now successfully installed and configured the MariaDB database on CentOS 7. You can now start creating tables and inserting data into this database.

bannerAds