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
Previous articleSetting Up Nginx with FastCGI-Cache Module on Ubuntu 20.04 LTS (Focal Fossa)
Next articleHow To Set CHMOD on Linux Distribution System via CLI
I'm just an freelancer and part-time worker at several freelance sites. Here at knot35.com we will share everything knowledge about Linux, Unix-Like, and open-source softwares.


Please enter your comment!
Please enter your name here