Stack Engineer

Install MariaDB on CentOS

MariaDB is the community fork and drop-in replacement for MySQL that was started after Oracle acquired MySQL.

Step 1 - Install and Start MariaDB

Run the following commands to install MariaDB, start the MariaDB server and set it so that it automatically starts on system boot.

sudo yum install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 2 - Initial Configuration

Run the following command to change some of the default settings for MariaDB. This includes allowing you to set the root password, remove anonymous accounts, disable remote root login, and remove test databases.

sudo mysql_secure_installation

Step 3 - Login for the First Time

You can login for the first time running the following command.

mysql -u root -p