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

ChangeCreate thean rootadmin user/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 changeadd thea new user with a specified password (modify the password accordingly):

ALTERCREATE USER 'root'administrator'@'localhost' IDENTIFIED BY 'MyN3wP4ssw0rd'MyPassword1234';
flushGRANT privileges;ALL exit;PRIVILEGES ON *.* TO 'administrator'@'localhost';
FLUSH PRIVILEGES;
EXIT;