Install MariaDB 10.4 on Ubuntu 18.04

Hello friends, this tutorial is specially targeted on moodle installation. When I tried to install MariaDB updated version, server installed the old one. But When I tried to upgrade with MySQL-upgrade command, server said, you have the latest version. But moodle said, not you don’t have the latest version, just update it to 10.2 or later.

This was very very hard because of my lack of knowledge in the Linux and this MariaDB thing. But, with my googling knowledge I could find a better solution for this problem. I’m not gonna type much more. But you can follow the following steps very carefully.

0. Remove the Installed Version

sudo apt-get remove mariadb-server

1. Install software-properties-common if missing

sudo apt-get install software-properties-common

2. Import MariaDB gpg key:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

3. Add the apt repository (SHOULD BE IN ONE LINE)

sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mariadb.mirror.liquidtelecom.com/repo/10.4/ubuntu $(lsb_release -cs) main"

4. Install MariaDB

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