MariaDB Binary tarballs are named following the pattern: mariadb-VERSION-OS.tar.gz. Be sure to download the correct version for your machine.
Note: Some binary tarballs are marked '(GLIBC_2.14)' or '(requires GLIBC_2.14+)'. These binaries are built the same as the others, but on a newer build host, and they require GLIBC 2.14 or higher. Use the other binaries for machines with older versions of GLIBC installed. Run ldd --version
to see which version is running on your distribution.
Others are marked 'systemd', which are for systems with systemd.
To install the binaries, 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 versions 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
"
Ensure you use the correct my.cnf files
MariaDB searches for the configuration files '/etc/my.cnf
' (on some systems '/etc/mysql/my.cnf
') and '~/.my.cnf
'. If you have an old my.cnf
file (maybe from a system installation of MariaDB or MySQL) you need to take care that you don't accidentally use the old one with your new binary .tar installation.
The normal solution for this is to ignore the my.cnf
file in /etc
when you use the programs in the tar file.
This is done by creating your own .my.cnf file in your home directory and telling mysql_install_db
, mysqld_safe and possibly mysql (the command-line client utility) to only use this one with the option '--defaults-file=~/.my.cnf
'. Note that this has to be first option for the above commands!
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' (to keep compatibility with MySQL installations):
groupadd mysql useradd -g mysql mysql cd /usr/local tar -zxvpf /path-to/mariadb-VERSION-OS.tar.gz ln -s mariadb-VERSION-OS mysql cd mysql ./scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data
The symlinking with ln -s
is recommended as it makes it easy to install many MariaDB version at the same time (for easy testing, upgrading, downgrading etc).
If you are installing MariaDB to replace MySQL, then you can leave out the call to mysql_install_db
. Instead shut down MySQL. MariaDB should find the path to the data directory from your old /etc/my.cnf
file (path may vary depending on your system).
To start mysqld you should now do:
./bin/mysqld_safe --user=mysql & or ./bin/mysqld_safe --defaults-file=~/.my.cnf --user=mysql &
To test connection, modify your $PATH so you can invoke client such as mysql, mysqldump, etc.
export PATH=$PATH:/usr/local/mysql/bin/
You may want to modify your .bashrc or .bash_profile to make it permanent.
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 --defaults-file=~/.my.cnf
If you have problems with the above gunzip command line, you can instead, if you have gnu tar, do:
tar xfz /path-to/mariadb-VERSION-OS.tar.gz
To start mysqld you should now do:
./bin/mysqld_safe --defaults-file=~/.my.cnf &
Auto start of mysqld
You can get mysqld (the MariaDB server) to autostart by copying the file mysql.server
file to the right place.
cp support-files/mysql.server /etc/init.d/mysql.server
The exact place depends on your system. The mysql.server
file contains instructions of how to use and fine tune it.
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.5 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.
Hi, I have been trying to install mariadb 10.1.8 from Binary referring this document. But there are no clear cut steps to be followed as I am stumbling upon every step while calling the script mysql_install_db. I am installing this on a clean slate. Am I supposed have / copy any preexisting files to certain directories?
I am getting below error -
You are probably using a configuration file in /etc. Make sure you have your own configuration file, usually in the mariadb server base directory. For example, if the base directory is /usr/local/mysql, you should execute: ./scripts/mysql_install_db --basedir=/usr/local/mysql --defaults-file=/usr/local/mysql/my.cnf
To check which version of GLIBC you have installed: ldd --version
You can also "run" the libaray: /lib/libc.so.6