Setting up MariaDB for virtual domains and users

Since we have already installed MariaDB (the drop-in replacement for MySQL) during the postfix installation, we can proceed to the configuration. But if we ever needed to reinstall the package again, we can always use yum:

$ sudo yum install mariadb-server

The first thing to do to start the MariaDB configuration is to start the service. Also, we need to add it to the system startup services:

$ sudo systemctl enable mariadb.service
$ sudo systemctl start mariadb.service

Then we start the configuration by setting up the secure installation mode where we can set up or change the MariaDB root password, remove anonymous user accounts, disable root logins outside of the local host, and so on:

$ sudo mysql_secure_installation ...

Get Mastering CentOS 7 Linux Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.