Hero Image

MariaDB setup on centos 7

Update your system:

sudo yum update

Install and Start MariaDB

sudo yum install mariadb-server

Enable MariaDB to start on boot and then start the service:

sudo systemctl enable mariadb
sudo systemctl start mariadb

MariaDB will bind to localhost (127.0.0.1) by default. For information on connecting to a remote database using SSH, see our MySQL remote access guide, which also applies to MariaDB.

Allowing unrestricted access to MariaDB on a public IP not advised but you may change the address it listens on by modifying the bind-address parameter in /etc/my.cnf. If you decide to bind MariaDB to your public IP, you should implement firewall rules that only allow connections from specific IP addresses.

Harden MariaDB Server Run the mysql_secure_installation script to address several security concerns in a default MariaDB installation:

sudo mysql_secure_installation

Port 3306 is configured in firewall

On RHEL and CentOS 7, it may be necessary to configure the firewall to allow TCP access to MySQL from remote hosts. To do so, execute both of these commands:

firewall-cmd --add-port=3306/tcp
firewall-cmd --permanent --add-port=3306/tcp