How To Install MariaDB from Binary Tarballs on Ubuntu 13.10

Published on January 28, 2014

Wytze Hazenberg

How To Install MariaDB from Binary Tarballs on Ubuntu 13.10

About MariaDB

Currently, MariaDB is a drop-in replacement for MySQL. This article describes the installation of MariaDB version 5.5.34 x86_64 on an Ubuntu 13.10 VPS. Binary tarballs are used for installation instead of the software repositories available through apt-get. A potential rationale for this choice would be to have complete control over the installed version of MariaDB.


There are two 64-bit versions of MariaDB on the MariaDB download page. The difference between the two versions is that one version requires GLIBC 2.14+.

To check your installed GLIBC version:

ldd --version

Output will be something like:

ldd (Ubuntu EGLIBC 2.17-93ubuntu4) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
Written by Roland McGrath and Ulrich Drepper.

In this case, version 2.17 is installed and we can proceed with downloading “mariadb-5.5.34-linux-x86_64.tar.gz” (requires GLIBC_2.14+).

You have to decide where you want to put the binaries, i.e. the application itself. Some opt for /usr/local/ or /opt/. Here we choose the latter.

Let’s create the directory and download the tarball:

mkdir /opt/mariadb/
cd /opt/mariadb/
wget --output-document=mariadb-5.5.34-linux-x86_64.tar.gz https://downloads.mariadb.org/f/mariadb-5.5.34/kvm-bintar-quantal-amd64/mariadb-5.5.34-linux-x86_64.tar.gz/from/http:/mariadb.mirror.triple-it.nl/

Calculate the MD5 sum to verify whether the tar is valid:

md5sum mariadb-5.5.34-linux-x86_64.tar.gz

The output should match the MD5 sum given by MariaDB on the download page: 14ca3e88eb67bced630569100173ef55.


In /opt/mariadb/, extract the tar archive:

# tar xf mariadb-5.5.34-linux-x86_64.tar.gz

Symbolic links are useful to link the used/installed version to a version specific MariaDB binary directory, for easy updating to a newer version, or to revert to a previously used version in case of failure.

To create the symlink:

ln -s /opt/mariadb/mariadb-5.5.34-linux-x86_64 /opt/mariadb/mysql

Create a new user and group for MariaDB’s process to run in:

groupadd mysql
useradd -g mysql mysql

Change ownership of the binary files to the newly created user and group:

chown -R mysql:mysql /opt/mariadb/mysql/


Copy your my.cnf configuration file to /etc/my.cnf. If you do not have a configuration file already, there are some files in /opt/mariadb/mysql/support-files/ to get you started. For demonstration purposes, my-small.cnf is used:

cp /opt/mariadb/mysql/support-files/my-small.cnf /etc/my.cnf

At least set the following directives in /etc/my.cnf:


basedir specifies the location of the binary files, datadir specifies where the actual database files are stored, and user specifies that MariaDB is run under the user mysql. Typically, not setting a datadir defaults to /usr/local/mysql/data.

Just to be sure the datadir directory is there:

mkdir -p /var/lib/mysql

Initialize system tables

Like MySQL, MariaDB’s system tables have to be initialized:

/opt/mariadb/mysql/scripts/mysql_install_db --user=mysql --basedir=/opt/mariadb/mysql

System service

For MariaDB to be started automatically after a system reboot, we can add a system service:

ln -s /opt/mariadb/mysql/support-files/mysql.server /etc/init.d/mysql
update-rc.d mysql defaults

To start the service:

service mysql start

If you prefer to start MariaDB manually, use:

/opt/mariadb/mysql/bin/mysqld_safe --user=mysql --ledir=/opt/mariadb/mysql/bin &

Configure MariaDB

Be sure that MariaDB is up and running.

A root account is required for further configuration, to set up a root account:

/opt/mariadb/mysql/bin/mysqladmin -u root password '<pwd>'

Where <pwd> is the password desired for the root user.

Additional security configuration:

/opt/mariadb/mysql/bin/mysql_secure_installation --basedir=/opt/mariadb/mysql

which asks a couple of questions after supplying it the previously specified root password. Provide the following configuration answers:

change root pwd: n
remove anonymous users: y
disallow root login remotely: y
remote test database and access to it: y
reload privilege tables now: y

Manual entries and global execution of binaries

When manually installing MariaDB, there are no manual entries and typing a system wide command like mysql results in a The program 'mysql' is currently not installed-like error.

Put the following entries in .bashrc or similar environment file that is loaded at system level or user level. For example, vim /root/.bashrc:


Test it

Reboot the machine to test if all works correctly:

# reboot

That MariaDB is running can be verified by:

# service mysql status

try and see if the manual works:

man mysql

try and see if MariaDB works:

mysql -u root -p

Supply the root password and you should see something similar to:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.34-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Next step is to further configure the database with user accounts and import data.

<div class=“author”>Article Submitted by: <a href=“https://twitter.com/whazenberg”>Wytze Hazenberg </a></div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us

About the authors
Default avatar
Wytze Hazenberg


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Etel Sverdlov
DigitalOcean Employee
DigitalOcean Employee badge
February 4, 2014

We’ll get the title updated. Wytze Hazenberg and arsfeld are correct

Correct. I guess DO didn’t like the title I supplied ;)

So, you are not installing from source if you are downloading a binary tarball from MariaDB’s website.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel