Ubuntu 20.04 LTS is available with MySQL 8.0 as their default database version. So if you want to replace MySQL 8.0 with MariaDB 10.4, we need to add an official MariaDB repository to your Ubuntu machine.

Simply run the following command to build MariaDB 10.4:

1.) Add MariaDB 10.4 Repository

$ sudo apt install software-properties-common
$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.rackspace.com/mariadb/repo/10.4/ubuntu focal main'

2.) Run System Update and Let’s Install MariaDB 10.4

$ sudo apt update
$ sudo apt install mariadb-server

3.) Start MariaDB Service and Enable it Automatically From Boot

$ systemctl enable mariadb.service
$ systemctl start mariadb

4.) Set Root Password and Securing MariaDB Installation

Since we have not set root password during installation above, we can set a new root password during securing MariaDB installation. Simply run the following command

$ mysql_secure_installation

Simply Press ENTER to using temporary MariaDB root password. After that, you can change a root password during this process.

Check your MariaDB version

$ mysql -V
mysql Ver 15.1 Distrib 10.4.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

LEAVE A REPLY

Please enter your comment!
Please enter your name here