Skip to main content

Install MariaDB 10.1 on Ubuntu14.04 and 16.04

install mariadb

I always like to install software packages from official repository (if there’s one) rather than from my Linux distribution repository. For one thing, I can install the latest stable version. For another, I don’t have to worry about distribution specific modifications. In other words, what I got is a bog-standard package no matter what Linux distribution I use.

This tutorial will guide you through the process of installing the latest stable version of MariaDB and that’s MariaDB 10.1 on Ubuntu 14.04 and 16.04. Ubuntu repository has MariaDB 10.0, but no MariaDB 10.1.

Step 1: Install software-properties-common

sudo apt-get install software-properties-common

Step 2: Fetch MariaDB signing key from Ubuntu’s key server.

sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8

Step 3: add MariaDB repository to your system.

Ubuntu 14.04

sudo add-apt-repository 'deb [arch=amd64,i386] trusty main'

Ubuntu 16.04

sudo add-apt-repository 'deb [arch=amd64,i386] xenial main'

Step 4: update local package index and install mariadb-server

sudo apt-get update && sudo apt-get install mariadb-server mariadb-client

You will be asked to set a password for the MariaDB root user.

install mariadb

After it’s installed, mysqld process will be automatically started.

Check version

mysql --version
install mariadb

Finally we should execute the secure installation script to remove anonymous user, disable remote root login and remove test database for security reasons.



If during the installation process, you encounter an error like below:

dpkg: dependency problems prevent configuration of mariadb-server:
 mariadb-server depends on mariadb-server-10.1 (= 10.1.17+maria-1~xenial); however:
  Package mariadb-server-10.1 is not configured yet.

That’s probably because your previously installed MariaDB/MySQL server is still running. To fix this error, you need to stop the currently running mysqld process.

sudo kill -9 $(pgrep mysql)

And run the install command again.

sudo apt-get install mariadb-server mariadb-client

Check MariaDB status:

systemctl status mariadb

We can see that it’s running.

● mariadb.service - MariaDB database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
   Active: active (running) since Sun 2016-09-18 01:30:09 CST; 1min 57s ago
  Process: 26932 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)

If the above method doesn’t work for you, then check out MariaDB error log /var/log/mysql/error.log to find out the cause.

That’s it! As always, if you found this post useful, subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page. Thanks for visiting!

Rate this tutorial
[Total: 2 Average: 3.5]