How to Install MariaDB on Ubuntu 1804

How To Install MariaDB On Ubuntu 18.04 LTS

On this article we will discuss how to install MariaDB on Ubuntu 18.04 LTS and how to secure it in a simple explanation. MariaDB is as MySQL database replacement since MySQL is acquired by Oracle Corp.

Introduction

MariaDB is an open-source relational database management system compatible replacement for MySQL. MariaDB was created by one of MySQL’s original developers in 2009 after MySQL was acquired by Oracle during the Sun Microsystems merger. M

In this article we will discuss how to install MariaDB on Ubuntu 18.04 LTS. There will be several steps for installing MariaDB on Ubuntu. We will use the Ubuntu repository for this purpose.

  • Prerequisite MariaDB Installation
  • MariaDB Installation
  • Securing MariaDB

Prerequisite

Before continuing with this tutorial, we have to prepare our Ubuntu environment first. MariaDB installation requires a user with sudo privileges, sufficient space and the last update of Ubuntu repository. In our environment we have all the necessary requirements. To ensure our CentOS 7 is running on the last update, we have to submit command line as below :

MariaDB Installation

On MariaDB installation phase, there are several action as described below.

Setep 1. Add MariaDB repository to existing system. By command line below.

mpik@indoprinter3d:~$ apt-get install software-properties-common

Install MariaDB on Ubuntu

Step 2. Import MariaDB gpg key. This step will be done by submitting comand line below.

mpik@indoprinter3d:~$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

Install MariaDB on Ubuntu 18.04

Step 3: Add the apt repository. Once the gpg key has been fetch, the next step is adding the repository URL to the system.

mpik@indoprinter3d:~$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.jaleco.com/mariadb/repo/10.4/ubuntu bionic main'

Install MariaDB on Ubuntu

Step 4. Update the all system by submitting command line below.

mpik@indoprinter3d:~$ apt update

Install MariaDB on Ubuntu apt update

Step 5. Install MariaDB. The last step is installing the MariaDB by submitting the command line below.

mpik@indoprinter3d:~$ sudo apt install mariadb-server

install mariaDB

We will be prompted to provide MariaDB root password, type the password to set.

Securing MariaDB

For the fresh MariaDB installations, the next step is to run security script. This script will change some of the less secure default options. We will use it to block remote root logins and to remove unused database users. The script was ready to be executed.

mpik@indoprinter3d:~$ sudo mysql_secure_installation

Securing MariaDB

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] n
 ... skipping.

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

So far we have through all the step of installing MariaDB on Ubuntu.

 

Share this article via :

One thought on “How To Install MariaDB On Ubuntu 18.04 LTS

Leave a Reply

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