Skip to main content

Install MariaDB

Install MariaDB

sudo apt install -y mariadb-server mariadb-client

Allow remote access if needed

To allow remote access we need to change the bound IP address for MariaDB. Edit the configuration file:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Find the bind-address line and change the IP from 127.0.0.1 to 0.0.0.0 and it should look like this:

bind-address            = 0.0.0.0

Enable MariaDB to run as a system service

sudo systemctl enable mariadb

Secure the installation

sudo mysql_secure_installation

Change the root password manually

Many times the root password needs it's password manually set even though the mysql_secure_installation is supposed to do this.

Login with root privileges:

sudo -i
mysql

Run these commands to change the password (modify the password accordingly):

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyN3wP4ssw0rd';
flush privileges;
exit;