Saturday, September 12, 2020

How to Install Latest MariaDB on Ubuntu 20.04 Linux

 How to Install MariaDB on Ubuntu 20.04 Linux

How to Install Latest MariaDB on Ubuntu 20.04 Linux
MariaDB is free an open-source Relational Database Management System (RDBMS) maintained by MariaDB foundation and published under the GPLv2 license. This post guide you to install MariaDB on Ubuntu 20.04 Server. At the time of writing this post, MariaDB 10.5 was the latest version. Please check official website for complete list of MariaDB 10.5 features and updates.
Prerequisites:
1. Ubuntu 20.04 Linux running instance.
2. Internet to download packages.
3. Sudo or root access
. Installation Steps of Ubuntu Linux 20.04 LTS (Long Term Support) Server - Teclues.com

Step 1: Add APT Repository

MariaDB packages are available on Ubuntu 20.04 default repository which contains old version. So, add official repository if you want to install the latest version of MariaDB packages. Add MariaDB Repository to install MariaDB on your Ubuntu 20.04 system using following commands.
$ sudo apt-get install software-properties-common
$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
(Click on picture below to enlarge it.)
Create a file 'mariadb.list' file and add below lines on it, save and close the file.
$ sudo vi /etc/apt/sources.list.d/mariadb.list
# MariaDB 10.5 Repository
deb [arch=amd64] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main
deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main

Step 2: Install MariaDB on Ubuntu 20.04

Once you added the repository, run the following command to install latest MariaDB on Ubuntu 20.04 with all dependencies packages.
$ sudo apt update 
$ sudo apt install mariadb-server
(Click on picture below to enlarge it).
Following packages will installed:
galera-4
libdbd-mariadb-perl
libdbi-perl
libmariadb3
libterm-readkey-perl
mariadb-client-10.5
mariadb-client-core-10.5
mariadb-common
mariadb-server
mariadb-server-10.5
mariadb-server-core-10.5
socat

Step 3: Post MariaDB Installation Steps.

Run 'mysql_secure_installation' tool from terminal to set root password, remove anonymous user, remove test database, disable root login remotely etc. Follow the screenshots as shown below (Click on picture below to enlarge it).
$ sudo mysql_secure_installation

Remove anonymous user, Disallow root login remotely, Remove test database and Reload privilege tables (Click on picture below to enlarge it).

Step 4: MariaDB Service

After installation, mariadb.service will be on running state, following commands to start|enable|stop and check the status of mariadb.service
$ sudo systemctl status mariadb.service
$ sudo systemctl start mariadb.service
$ sudo systemctl enable mariadb.service
$ sudo systemctl stop mariadb.service

Step 5: Login on MariaDB Database

Run the following command from terminal to connect MariaDB database using password which was set on earlier step.
$ mysql -u root -p

 type '\h' or 'help' from mariadb console for help and 'exit' to return on OS terminal.

That's it! In this guide, we have learned MariaDB installation on Ubuntu 20.04 Linux. Please share it with others and use comment box below to raise a query if any. Also follow us on tecluesdotcom Facebook Official Page.

No comments:

Post a Comment

Please do not enter any spam link in the comment box.