Install MariaDB on Ubuntu 18.04

MariaDB is the fork of MySQL and backward compatible replacement for MySQL. Here in this tutorial, we are going to show you how to install MariaDB 10 on Ubuntu server in the following ways:

1. Install MariaDB from Ubuntu PPA
2. Install MariaDB from Official Repository.

In Ubuntu 18.04’s main repository by default contains repository for MariaDB. So the first way is recommended by us to install MariaDB.

Prerequisites

Before you start installing MariaDB 10.3 on Ubuntu 18.04. You must have non-root user account on your server with sudo privileges.

1. Install MariaDB from Ubuntu PPA

As Ubuntu 18.04 by default has MariaDB repository in its main repository. You will first update package manager index then you will install MariaDB 10 on Ubuntu.

To Update apt package manager index type following command.

sudo apt update

Install MariaDB server by typing following and hitting Enter.

sudo apt install mariadb-server

Now confirm the installation by typing following

mysql -V

The output should be :

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

After installation, MariaDB will start automatically. To check status type following command.

sudo systemctl status mariadb

The output should be :

● mariadb.service - MariaDB database server
    Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset
    Active: active (running) since Sun 2018-10-11 14:15:57 UTC; 38s ago
    Main PID: 14532 (mysqld)
    Status: "Taking your SQL requests now..."
    Tasks: 27 (limit: 507)
    CGroup: /system.slice/mariadb.service
        └─14532 /usr/sbin/mysqld

2. Installing MariaDB from Official Repository

MariaDB officially supports installer for MariaDB. Here you will need to download it from one of the mirrors at [MariaDB Download Page](http://https://downloads.mariadb.org/mariadb/repositories).

Import MariaDB key to your system by typing following

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

After Importing key add MariaDB repository

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic main'

Now update the apt package manager index by typing following

sudo apt update

Install MariaDB server by typing following and hitting Enter.

sudo apt install mariadb-server

Now confirm the installation by typing following

mysql -V

The output should be :

Output:
mysql Ver 15.1 Distrib 10.1.29-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

After installation, MariaDB will start automatically. To check status type following command.

sudo systemctl status mariadb

3. Setting Up MariaDB

After installation, we have to improve MariaDB security by typing following

sudo mysql_secure_installation

NOTE: it is recommended to answer ‘Y’ for all questions asked during secure installation.

You can log in to MariaDB by typing

mysql -u root -p

Conclusion

You have successfully learned how to install MariaDB 10 on Ubuntu 18.04. If you have any queries please don’t forget to comment out.

Leave a Reply

Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>