(Last Updated On: October 9, 2018)

This post will guide you through the installation of MariaDB 10.3 on Ubuntu 16.04 LTS whose code name is Xenial. MariaDB is one of the most popular open source, relational database management systems.

For Ubuntu 18.04 / Ubuntu 18.04 server, use:  Install MariaDB 10.x on Ubuntu 18.04 and CentOS 7

For Debian 9 / Debian 8:  How to Install MariaDB 10.x on Debian 9 / Debian 8

MariaDB is a community-developed fork of the MySQL due to concerns over its acquisition by Oracle Corporation. It is intended to remain free under the GNU GPL. The development of MariaDB is led by some of the original developers of MySQL.

Install MariaDB 10.3 on Ubuntu 16.04 LTS

To install MariaDB 10.3 on Ubuntu 16.04, you need to add MariaDB repository on to the system. Run the following commands to import MariaDB repository PGP key and add the repository.

sudo apt -y install software-properties-common dirmngr
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu xenial main'

Update system package list and install MariaDB

sudo apt update
sudo apt -y install mariadb-server mariadb-client

You will be prompted to provide MariaDB root password.

Enter a password to set.

Confirm password:

Press <Ok> to confirm the new password and install MariaDB.

You can confirm installed MariaDB version by logging in as a root user.

# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.10-MariaDB-1:10.3.10+maria~xenial mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT version();
+----------------------------------------+
| version()                              |
+----------------------------------------+
| 10.3.10-MariaDB-1:10.3.10+maria~xenial |
+----------------------------------------+
1 row in set (0.001 sec)

Create a test database

MariaDB [(none)]> CREATE DATABASE test_db;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test_db            |
+--------------------+
4 rows in set (0.002 sec)

MariaDB [(none)]> DROP DATABASE test_db;
Query OK, 0 rows affected, 2 warnings (0.002 sec)

MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)

Thanks for installing MariaDB 10.3 on Ubuntu 16.04 LTS server. You should now have a working MariaDB database server ready for production use.