How to Install and Configure MySQL / MariaDB on CentOS 7

MySQL is replaced with MariaDB in CentOS 7. MariaDB is a popular drop-in replacement for MySQL.

1) Install the MariaDB-server package:

# sudo yum install mariadb-server

2) Set MariaDB to start at boot and start the daemon for the first time:

# sudo systemctl enable mariadb.service
# sudo systemctl start mariadb.service

3) Run mysql_secure_installation to secure MariaDB. You will be given the option to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases and reload privileges. It is recommended that you answer yes to these options:

# sudo mysql_secure_installation

4) See MySQL Status

#sudo systemctl status mariadb.service