How to Install MariaDB in Ubuntu 20.04 LTS

MariaDB is an Open Source database Server and It is 100 % compatible  with MySQL and consider as drop-in replacement to MySQL database server.

Background of MariaDB

In 2008, MySQL was acquired by Sun Microsystems, which was in turn acquired by Oracle Corporation in 2010. While the initial acquisition by Sun was hailed by many in the MySQL community as exactly what the project needed, that sentiment did not last, and the subsequent acquisition by Oracle was unfortunately met with far lower expectations. Many of MySQL’s developers left Sun and Oracle to work on new projects . Among them was Michael ‘Monty’ Widenius, creator of MySQL and one of the project’s longtime technical lead. Monty and his team created a fork (offshoot) of the MySQL code base and named his new DBMS MariaDB

In this post, we will cover how to install latest and stable version of MariaDB in Ubuntu 20.04 LTS system.

Let’s jump into MariaDB installation steps,

Step 1) Update package index

Login to your Ubuntu 20.04 system and open the terminal and run following apt command,

$ sudo apt update

Update-Package-Index-Ubuntu-20-04

Step 2) Configure MariaDB Package Repository

At the time of writing this guide, latest version of MariaDB was 10.6. But the latest version of  MariaDB package is not available in the default package repositories. So we must configure MariaDB repository first.

Run following commands to install MariaDB dependencies, fetch keys and configure mariadb package repository.

$ sudo apt install -y 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] https://mirrors.bkns.vn/mariadb/repo/10.6/ubuntu focal main'

Step 3) Install MariaDB using apt command

Now, we are all set to install latest version of mariadb server, run beneath commands to install it

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

Once the mariadb-server is installed then start it’s service.

Step 4) Start and Enable MariaDB Service

To start MariaDB service, run

$ sudo systemctl start mariadb

To enable mariadb service, run

$ sudo systemctl enable mariadb

To verify MariaDB Service status, run

$ sudo systemctl status mariadb

MariaDB-Service-Status-Ubuntu-20-04

Perfect, Above confirms that mariadb service is up and running.

Step 5) Secure MariaDB Installation

To secure the mariadb installation, run ‘mysql_secure_installation‘ command to set root password, remove anonymous users, disallow remote root login and remove test database.

$ sudo mysql_secure_installation

Set-Root-Password-MariaDB-Ubuntu-20-04

Disallow-Remote-Root-Login-MariaDB-Ubuntu-20-04

Reload-Privilege-tables-MariaDB-Ubuntu

Step 6) Connect to MariaDB from Command Line

To Connect to mariadb from command line use mysql client, example is shown below,

$ mysql -uroot -p

Enter the root password that we have set it during secure installation step,

mysql-client-ubuntu-20-04

Great, we are able to connect to our MariaDB database server. That’s all from this guide, I have these steps help you install latest version of MariabDB on your Ubuntu 20.04 LTS system. Please do share your feedback and comments in the below comments section.

Read Also : How to Install VLC Media Player on Ubuntu 20.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *