Installing MariaDB on Ubuntu 20.04 Print

  • 0

Prerequisites


To follow this tutorial you will need a non-root administrative user.

Installing MariaDB


On this version of Ubuntu, you can install MariaDB using the APT package repository.

To install it, update the package index on your server if you haven't done so recently.

sudo apt update


Then proceed to install the MariaDB package.

sudo apt install mariadb-server


This installs MariaDB, but leaves it unsecure by default so we'll need to patch some things up!

Configuring MariaDB


If you've just completed the fresh install, you'll need to run the following command to configure MariaDB:

sudo mysql_secure_installation


Firstly, it will ask you to enter the current password set for the root user. Since you've just installed MariaDB, there shouldn't be one so just hit ENTER.

The next prompt asks you whether you’d like to set up a database root password. On Ubuntu, the root account for MariaDB is tied closely to automated system maintenance, so we should not change the configured authentication methods for that account. Type N and then press ENTER.

After this, you can hit Y and ENTER for all other questions. This will remove any anonymous users, the test database and disable remote root logins.

Testing MariaDB


When installed using our above method, MariaDB will automatically start running immediately, as well as every reboot. To test that it's running correctly, run the command:

sudo systemctl status mariadb


If it's green and shows as active, then MariaDB is all set up and running!

If it's not running, then run the following command:

sudo systemctl start mariadb


And you should be good to go!


Was this answer helpful?

« Back