Installing MariaDB Binary Packages
This page contains installation instructions for a MariaDB binary distribution.
Contents
Binary Tarballs (mariadb-VERSION-OS.tar.gz)
Short version:
To install the binaries (downloadable here),
unpack the distribution into the directory of your choice and run the mysql_install_db
script.
In the example below we install MariaDB in the /usr/local/mysql
directory (this is the default location for MariaDB for many platforms). However any other directory should work too.
We install the binary with a symlink to the original name. This is done so that you can easily change MariaDB version just by moving the symlink to point to another directory.
NOTE: For MariaDB 5.1.32 only the line "./scripts/mysql_install_db --user=mysql" should be changed to "./bin/mysql_install_db --user=mysql"
Installing MariaDB as root in /usr/local/mysql
If you have root access to the system, you probably want to install MariaDB under the user and group 'mysql' (too keep things compatible with MySQL installations):
groupadd mysql useradd -g mysql mysql cd /usr/local gunzip < /path-to/mariadb-VERSION-OS.tar.gz | tar xf - ln -s mariadb-VERSION-OS mysql cd mysql ./scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data
To start mysqld you should now do:
./bin/mysqld_safe --user=mysql &
Installing MariaDB as not root in any directory
Below, change /usr/local to the directory of your choice.
cd /usr/local gunzip < /path-to/mariadb-VERSION-OS.tar.gz | tar xf - ln -s mariadb-VERSION-OS mysql cd mysql ./scripts/mysql_install_db
To start mysqld you should now do:
./bin/mysqld_safe &
Post installation
After this, remember to set proper passwords for all accounts accessible from untrusted sources, to avoid exposing the host to security risks! Also consider using the mysql.server to start MariaDB automatically when your system boots.
Our MariaDB binaries are similar to the Generic binaries available for the MySQL binary distribution. So for more options on using these binaries, the MySQL 5.1 manual entry on installing generic binaries can be consulted.
For details on the exact steps used to build the binaries, see the compiling MariaDB section of the KB.
Running several MariaDB / MySQL binaries on the same computer
The main problem in having many MariaDB running on the same computer is that you will get conflicts between port and sockets.
The solution for this, when you want to have your own installation of MariaDB, is to add something like this in your /.my.cnf file:
[client] # TCP port to use to connect to mysqld server port=3306 # Socket to use to connect to mysqld server socket=/tmp/mysql.sock [mariadb] # TCP port to make available for clients port=3306 # Socket to make available for clients socket=/tmp/mysql.sock # Where MariaDB should store all it's data data=/usr/local/mysql/data
The above are the default values. Change them to some unique values for your installation.
The above should be enough to get mysqld
to start and for clients like mysql
to connect to it. Documentation for other options can be found here.
To check what values mysqld
is using, you can do:
mysqld --print-defaults
To list the default values, check the end of:
mysqld --help --verbose
If your problem is that mysqld
reads options from system my.cnf files (like /etc/my.cnf) you can force it to only read one specific configuration file:
mysqld --defaults-file=~/.my.cnf
Linux Distributions Which Include MariaDB
The following linux distributions include MariaDB in their package repositories. For these you can use the distribution's management system to install MariaDB.
- Gentoo
- openSUSE UNSTABLE — MariaDB 5.2 is available in the UNSTABLE repository
- openSUSE STABLE — MariaDB 5.1 is available in the STABLE repository
Debian .deb Files
Here are the commands we used on Debian 5 amd64 to install MariaDB 5.1.42 (other Debian-based distributions should be similar):
sudo apt-get update sudo apt-get install libdbi-perl libdbd-mysql-perl psmisc sudo dpkg --install mysql-common_5.1.42-mariadb73_all.deb sudo dpkg --install libmariadbclient16_5.1.42-mariadb73_amd64.deb libmysqlclient16_5.1.42-mariadb73_amd64.deb \ mariadb-client_5.1.42-mariadb73_all.deb mariadb-client-5.1_5.1.42-mariadb73_amd64.deb mariadb-server_5.1.42-mariadb73_all.deb \ mariadb-server-5.1_5.1.42-mariadb73_amd64.deb
The .deb files can be downloaded from http://downloads.askmonty.org.
From Source
See the Compiling page for instructions on compiling and installing MariaDB from source.