We’ll show you, how to install MariaDB on Ubuntu 16.04. MariaDB is a community-developed fork of MySQL. It is a free and open source, very fast, stable and scalable database server, which makes it one of the most used database servers in the world. It is an improved, drop-in replacement for popular MySQL Database Server. In this tutorial, we will show you how to install MariaDB on Ubuntu 16.04. Installing MariaDB on Ubuntu 16.04 is an easy task, and if you carefully follow the steps of this tutorial, you should have MariaDB installed on your Ubuntu 16.04 server in less than 10 minutes. Let’s get started.
Table of Contents
1. Connect to your server
First, you will need to login to your server via SSH as user root:
ssh root@IP_ADDRESS -p PORT_NUMBER
and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.
2. Update your system
Before we start, let’s make sure your system is up-to-date by running the following commands:
apt-get update apt-get upgrade
3. Installing MariaDB on Ubuntu 16.04
Before we start with the MariaDB Server installation, you will need to add the official MariaDB repository.
First, install the
software-properties-common package to your server with the following command:
apt-get install software-properties-common
Next, import the MariaDB GnuPG signing key to your system, by executing the following command:
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
And finally, add the MariaDB repository with:
add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.3/ubuntu xenial main'
To be able to initiate the MariaDB installation from the newly added repository, you will now need to update the package list with:
You can now install MariaDB on your server with:
apt-get install mariadb-server
Once the installation is complete, the MariaDB service will be started automatically. To verify if the service is running on your system, you can run the following command:
systemctl status mariadb
You should see the following output on your screen:
● mariadb.service - MariaDB 10.3.10 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: active (running) since Sat 2018-10-27 13:37:11 CDT; 1h 3min ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 15152 (mysqld) Status: "Taking your SQL requests now..." CGroup: /system.slice/mariadb.service └─15152 /usr/sbin/mysqld
And to check the MariaDB version you can type:
mysql -V mysql Ver 15.1 Distrib 10.3.10-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
4. Securing your MariaDB installation on Ubuntu 16.04
After the installation is complete, you can improve the security of your MariaDB server, by running the
mysql_secure_installation script, using the following command:
You will be asked to enter your current password for the MariaDB root user. If you did not set any password during the installation, you can just leave it blank and press Enter:
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 you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none):
You can then choose to change your root password or leave it as it is.
Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n]
After this, you will get asked a couple of more questions and it is recommended that you answer ‘yes’ to all of them:
Remove anonymous users? [Y/n] Disallow root login remotely? [Y/n] Remove test database and access to it? [Y/n] Reload privilege tables now? [Y/n]
Once you complete all the steps, the following output will be displayed on your screen:
All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
5. Connect to MariaDB
Now after you are done with installing and securing MariaDB, you can type the following command to connect to your MariaDB server:
mysql -u root -p
You will be asked for your MariaDB root password that has been set during the installation or during the
This will grant you access to the MariaDB shell:
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 21 Server version: 10.3.10-MariaDB-1:10.3.10+maria~xenial-log mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
And that’s it, with the completion of this step we are done installing MariaDB on Ubuntu 16.04.
Of course, you don’t have to install MariaDB on Ubuntu 16.04, if you use one of our MariaDB Hosting services, in which case you can simply ask our expert Linux admins to install and configure MariaDB on your Ubuntu 16.04 server. They are available 24×7 and will take care of the installation and configuration immediately.
PS. If you liked this post on Installing MariaDB on Ubuntu 16.04, please share it with your friends on the social networks using the buttons below or simply leave a reply. Thanks.