How To Install MariaDB from Binary Tarballs on Ubuntu 13.10
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-x8664.tar.gz” (requires GLIBC2.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
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
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
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,
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>