Generic Build Instructions

You are viewing an old version of this article. View the current version here.

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 if you use Linux is to run one of the following commands (depending on your Linux distribution):

sudo apt-get build-dep mysql-server # for Debian and Ubuntu-based distributions
sudo yum-builddep mysql # for Fedora
sudo zypper si -d mysql-community-server # for OpenSUSE

Note: On Debian-based distributions, you may receive a "You must put some 'source' URIs in your sources.list" error. To avoid this, 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

Refer to the documentation for your Linux distribution for how to do this on your system.

After editing the sources.list, do:

sudo apt-get update

...and then the above mentioned build-dep command.

Note: On openSUSE the source package repository may be disabled. The following command will enable it:

sudo zypper mr -er repo-source

After enabling it, you will be able to run the zypper command to install the build dependencies.

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 appropriate 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

Starting MariaDB for the first time

Prior to starting MariaDB for the first time:

  1. ensure the directory is owned by the mysql user (if the user doesn't exist, you'll need to create it)
  2. run the mysql_install_db script to generate the needed system tables

Here is an example:

# 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 &

Max builds configure line

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-aria-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.

Increasing version number or tagging a version

If you want to increase the version number or tag our version with a specific tag (shown in mysqld --version) you can do this by edit the file VERSION.

Post-Install tasks

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.