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:
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 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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
/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:
The output should match the MD5 sum given by MariaDB on the download page:
/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
basedir=/opt/mariadb/mysql datadir=/var/lib/mysql user=mysql
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
Just to be sure the
datadir directory is there:
mkdir -p /var/lib/mysql
Like MySQL, MariaDB’s system tables have to be initialized:
/opt/mariadb/mysql/scripts/mysql_install_db --user=mysql --basedir=/opt/mariadb/mysql
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 &
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>'
<pwd> is the password desired for the root user.
Additional security configuration:
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
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,
Reboot the machine to test if all works correctly:
That MariaDB is running can be verified by:
# service mysql status
try and see if the manual works:
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.
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!
Click below to sign up and get $200 of credit to try our products over 60 days!
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
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.