21 C
Senior Writer and partner

How to install MariaDB 10.6 on Ubuntu 20.04 / Ubuntu 18.04?

Debian and Ubuntu are some of the most stable Linux distributions out there. This is because the packages that are part of the official repositories are frozen and tested many times by many people. However, this brings a consequence: that we will not be able to have the most recent versions of the programs. An example of this is MariaDB which is a vital program for many people. So, today I will show you how to install MariaDB 10.6 on Ubuntu 20.4 / 18.04.

MariaDB is a well-known archi Database Relationships Management System that is a MySQL fork. This is due to the purchase of Sun Mycrosystem by Oracle. It is perfectly compatible with MySQL and is available in most Linux distributions.

In Ubuntu 20.04 and 18.04 LTS the version of MariaDB that is available in the official repositories is 10.3 and 10.1 respectively but recently has seen the release of version 10.5 with some interesting new features.

So, if you want to take advantage of having a recent version of this database manager, then welcome.

Install MariaDB 10.6 on Ubuntu 20.04 / 18.04

- Advertisement -

Open a terminal and install some necessary packages:

sudo apt-get install software-properties-common
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
Recommended packages:
The following packages will be upgraded:
python3-software-properties software-properties-common
2 upgraded, 0 newly installed, 0 to remove and 87 not upgraded.
Need to get 35.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]

Once they’re ready we need to add the special MariaDB repository. This adds a lot of ease and security to the process because we won’t be using third-party repositories.

First, add the GPG key:

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
Executing: /tmp/apt-key-gpghome.T8R2f9j18N/gpg.1.sh --fetch-keys https://mariadb.org/mariadb_release_signing_key.asc
gpg: requesting key from 'https://mariadb.org/mariadb_release_signing_key.asc'
gpg: key F1656F24C74CD1D8: public key "MariaDB Signing Key [email protected]" imported
gpg: Total number processed: 1
gpg: imported: 1

Now add the repository as such for Ubuntu 20.04

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.6/ubuntu focal main'

Or Ubuntu 18.04:

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.6/ubuntu bionic main'

Note: you can choose another mirror closer to you on the MariaDB website.
Once the new repository is added to the system repository list, you can refresh APT.
sudo apt update

And finally, install MariaDB 10.6 with the following command:

sudo apt install mariadb-server
Then you can check the installed version:
mysql --version
mysql  Ver 15.1 Distrib 10.6.3-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

With the installation of MariaDB a root password is not defined, so to define it use the mysql_secure_installation script

sudo mysql_secure_installation

Define the root password and then answer yes to all the questions asked.

Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n] 
Remove test database and access to it? [Y/n] 
Reload privilege tables now? [Y/n]

Now we are ready. MariaDB 10.6 is installed correctly.


MariaDB 10.6 is a good improvement over previous versions. But it is not always available in the official repositories of other Linux distributions. Today you have learned how to install it in Ubuntu 20.04 / 18.04.

So, share this post and join our Telegram Channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article