How to guides and technology tutorials for Amazon AWS, Google Cloud, Linux, macOS, Windows, and other systems

How to install MariaDB on CentOS

Published: 08 September 2016
Filed Under: CentOS

MariaDB is the community fork and drop-in replacement for MySQL that was started after Oracle acquired MySQL. This step-by-step guide will walk through the installation process for MariaDB on CentOS.

Install and start MariaDB

The following commands will install MariaDB, start the MariaDB server, and set it to automatically starts on system boot.

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

Initial configuration

This command initiates a shell script to improve the security of MariaDB by changing some of the default settings. This includes allowing you to set the root password, remove anonymous accounts, disable remote root login, and remove test databases.

sudo mysql_secure_installation

Login for the first time

To login to MariaDB as root, enter the following command. When prompted, enter the root password you assigned during Step 2.

mysql -u root -p