How to install MariaDB 10.3 on Ubuntu 18.04 and CentOS 7

Before you can install MariaDB 10.3, you may need to uninstall the current version of MariaDB server. You can ignore this if upgrading.  On Ubuntu, run:

sudo apt-get remove mariadb-server

For CentOS 7, run:

sudo yum remove mariadb-server

Install MariaDB 10.3 on Ubuntu 18.04

To install MariaDB 10.3 on Ubuntu 18.04, you need to add MariaDB repository on to the system.

Step 1: Install software-properties-common if missing:

sudo apt-get install software-properties-common

Step 2: Import MariaDB gpg key:

Run the command below to add Repository Key to the system

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

Step 3: Add the apt repository

Once the PGP key is imported, proceed to add repository URL to your Ubuntu 18.04 server:

sudo add-apt-repository ‘deb [arch=amd64] bionic main’

Step 4: Install MariaDB

The last step is the installation of MariaDB Server:

sudo apt update

sudo apt -y install mariadb-server mariadb-client

$ mysql -u root -p