Generic Build Instructions
The instructions on this page will help you compile MariaDB from source. Links to more complete instructions for specific platforms can be found on the source page.
First, get a copy of the MariaDB source.
Next, prepare your system to be able to compile the source. An easy way to do this on Ubuntu/Debian systems is to run the following command:
sudo apt-get build-dep mysql-server
N.B. To use this command and avoid this error : "You must put some 'source' URIs in your sources.list", ensure that /etc/apt/sources.list contains the source repositories. For Debain Squeeze :
deb http://ftp.debian.org/debian squeeze main contrib deb http://security.debian.org squeeze/updates main contrib deb-src http://ftp.debian.org/debian squeeze main contrib deb-src http://security.debian.org squeeze/updates main contrib
After edit, do an
apt-get update
If you don't want to run MariaDB as yourself, then you should create a
mysql
user. The example below uses this user.
Now cd into the source directory and execute the appropriate BUILD script that matches your configuration:
cd $maria-source-dir # ex: ~/repos/maria/trunk BUILD/compile-pentium64-max # Build for intel/amd 64 bit with all options BUILD/compile-pentium-max # Build for 32 bit pentum with all options BUILD/compile-pentium64-debug-max # Build for intel/amd 64 bit with debugging BUILD/compile-pentium64-valgrind-max # Build for testing with valgrind
To see what a build scripts does, you can run it with the --print
option.
If there is no apropriate script, you can also execute configure
directly:
cd $maria-source-dir # ex: ~/repos/maria/trunk BUILD/autorun.sh ./configure --with-plugin-xtradb make sudo make install # The following assumes that the 'mysql' user exists and that we installed MariaDB # in /usr/local/mysql chown -R mysql /usr/local/mysql/ scripts/mysql_install_db --user=mysql /usr/local/mysql/bin/mysqld_safe --user=mysql &
Assuming the commands above all finished successfully: Congratulations! You've just compiled and installed MariaDB!
The following configure line is the one we use in the -max builds (which includes all features we think are relevant). This is also the configure line we use with most of our binary builds:
./configure --prefix=/usr/local/mysql --enable-assembler \ --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables \ --with-plugin-maria --with-maria-tmp-tables --without-plugin-innodb_plugin \ --with-mysqld-ldflags=-static --with-client-ldflags=-static --with-readline \ --with-ssl --with-plugins=max-no-ndb --with-embedded-server --with-libevent \ --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static \ --with-zlib-dir=bundled --enable-local-infile
For a full list of options, you can do:
configure --help
If you want to test your compiled MariaDB, you can do either of:
make test
cd mysql-test ; mysql-test-run --force
NOTE: If you are testing or debugging MariaDB you may want to run it from where you have the source code instead of installing it with 'make install'. If so, see the Running MariaDB from the Source Directory page.