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

Create an admin user/password

Login with root privileges:

sudo -i
mysql

Run these commands to add a new user with a specified password (modify the password accordingly):

CREATE USER 'administrator'@'localhost' IDENTIFIED BY 'MyPassword1234';
GRANT ALL PRIVILEGES ON *.* TO 'administrator'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;