How to install MariaDB 10.2 in Ubuntu 16

Share this post to your friends !
  • 1

SystemMen - This article will show you how to install MariaDB 10.2 in Ubuntu 16.04.

MariaDB supports repository for operating systems based Redhat and Debian .

Add MariaDB repository

MariaDB has a page, allowing you to choose the repository that fits your OS.

You can access this link to get the configuration for Ubuntu 16.04.

Or you can follow the instructions below.

You run the following command to install and verify the key for the repository.

root@ubuntu16:~# apt-get install software-properties-common apt-transport-https -y
root@ubuntu16:~# apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8

Then, run the following command to add MariaDB’s repository to the machine’s APT tree.

root@ubuntu16:~# add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] xenial main'

Install MariaDB 10.2

After adding the repository, you run the command to update the packages.

root@ubuntu16:~# apt update -y

And then type the following command to install the MariaDB server.

root@ubuntu16:~# apt install mariadb-server -y

During installation, it will ask you to set a password for MariaDB’s root user.

Configuring mariadb-server-10.2

While not mandatory, it is highly recommended that you set a password for the MariaDB administrative "root" user.

If this field is left blank, the password will not be changed.

New password for the MariaDB "root" user:

You can set it now or later. You can also leave it blank.

The installation process may take several minutes.

how-to-install-mariadb-10-2-in-ubuntu-16 How to install MariaDB 10.2 in Ubuntu 16
Install MariaDB 10.2 in Ubuntu 16.04.

Enable and use mariadb

After the installation is completed, you can check the installed version with the following command.

root@ubuntu16:~# mysql -V
mysql Ver 15.1 Distrib 10.2.22-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Next, enable the mysql service.

root@ubuntu16:~# systemctl enable mysql

The results like this.

root@ubuntu16:~# systemctl enable mysql
mysql.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable mysql
insserv: warning: current start runlevel(s) (empty) of script `mysql' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).

And then start the service.

root@ubuntu16:~# systemctl start mysql

If you only allow access to local MariaDB, you don’t need to worry about firewalls.

If you want to allow remote access, you need to open port 3306 on the firewall.


Installing MariaDB on Ubuntu 16.04 is very easy. You just need to run a few lines of commands that are installed.

Installation is a story, using and optimizing MariaDB is another story.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.

Share this post to your friends !
  • 1
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.