Install MariaDB 10.1 on Ubuntu14.04 and 16.04

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: 13 Average: 4.7]

2 Responses to “Install MariaDB 10.1 on Ubuntu14.04 and 16.04

  • great…thanks a lot..
    also why official link is not working?–ubuntu_trusty&version=10.1
    Looks like they are aware but repository links are not working..

  • Daniel
    1 year ago

    After adding the MariaDB repo and running update, the following error is returned:

    W: GPG error: trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CBCB082A1BB943DB

    Is there a new instruction for adding the repo? I am installing on kubuntu 14.04

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB.
You can upload: image.