Install MariaDB on CentOS.
Update repo and install MariaDB.
sudo dnf update -y && \
sudo dnf install mariadb-server -y
Enable and start MariaDB.
sudo systemctl enable mariadb && \
sudo systemctl start mariadb && \
sudo systemctl status mariadb
For security, run security script that comes pre-installed with MariaDB to initialize.
sudo mysql_secure_installation
Verify installation by connecting as root:Bash
sudo mariadb -u root -p
Show databases while logged in to MariaDB.
SHOW DATABASES;
Create database.
CREATE DATABASE kodekloud_db2;
Create user and grant database privileges to the user.
GRANT ALL PRIVILEGES ON kodekloud_db2.* TO 'kodekloud_roy'@'%' IDENTIFIED BY 'dCV3szSGNA';
FLUSH PRIVILEGES;
Verify by connecting to MariaDB using the new user.
sudo mariadb -u kodekloud_roy -p
Show databases.
SHOW DATABASES;