How to Install or Upgrade to MariaDB 10.1, 10.2 and 10.3 on Ubuntu Linux

programmer 1653351 640
programmer 1653351 640

MariaDB Database is an open-source server that is a fork of MySQL and a drop-in replacement. It’s rapidly overtaking MySQL as the database server of choice on Linux systems.

The steps below are a good starting point for those wanting to install MariaDB 10.2 or 10.3 on Ubuntu 16.04 LTS.

Ubuntu 16.04 LTS has upgraded to MariaDB 10.1. Unfortunately, you won’t be able to upgrade via Ubuntu default repository, at least not yet. To upgrade to the latest, you must add its default repository; the steps below show you how.

When you’re ready to install MariaDB latest, follow the steps below:

Adding MariaDB repository on Ubuntu

First, make sure the software-properties-common package is installed. Then, just in case it’s not, run the commands below.

sudo apt-get install software-properties-common

Next, run the commands below to import MariaDB repository public key used by the package management system.

sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8

Finally, run the commands below to add MariaDB 10.1 repository to your Ubuntu machine.

sudo sh -c "echo 'deb '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB101.list"

The above commands add MariaDB 10.1 repository to Ubuntu with the latest packages. Remember to change the highlighted version number to the current latest.

To install MariaDB 10.2, run the commands below.

sudo sh -c "echo 'deb '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB102.list"

At the time of this writing, the latest current version was 10.2. The latest alpha version was 10.3

It’s recommended to upgrade to 10.1 before moving to 10.2 and up.

Installing MariaDB latest on Ubuntu

Now that the MariaDB 10.1 repository has been added to Ubuntu run the guides below to install the current version.

First, run the commands below to update your Ubuntu machines.

sudo apt-get update

Next, run the commands below to install the MariaDB server and client.

sudo apt-get install mariadb-server mariadb-client

Doing the installation, you may be prompted to create and confirm a new password for the MariaDB root user.

Please enter and confirm a password. You’ll need this password to manage the database server.

After that, MariaDB will be fully installed on your machine.

To secure the MariaDB database server, run the commands below:


When you run the above command, you’ll be prompted to create a root password, remove anonymous users, disable remote root access, and delete the test database.

Follow this guide below to answer the questions:

  • Enter current password for root (enter for none): Enter current password.
  • Change root password? N
  • Remove anonymous users? Y
  • Disallow root login remotely? Y
  • Remove test database and access to it? Y
  • Reload privilege tables now? Y

When you’re done, restart MariaDB, and you’re done.

That’s it!

To verify the MariaDB version, run the command below

mysql -V
mysql Ver 15.1 Distrib 10.2.12-MariaDB, for debian-linux-gnu (i686) using readline 5.2

That’s it!

You may also like the post below:

Posted by
Richard W

I love computers; maybe way too much. What I learned I try to share at


  1. Here are the commands to run to install MariaDB 10.3 from the MariaDB repository on your Ubuntu system:

    sudo apt-get install software-properties-common
    sudo apt-key adv –recv-keys –keyserver hkp:// 0xF1656F24C74CD1D8
    sudo add-apt-repository ‘deb [arch=amd64,arm64,ppc64el] bionic main’

    sudo apt-get install mariadb-server mariadb-client

  2. In the event you don’t have a display person, you’ll need certainly to download that,
    but otherwise, each game are at your convenience with no hassle of duplicating it to your pc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: