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.

If you don't want to run MariaDB as yourself, then you should create a mysql user. The example below uses this user.

Using cmake

MariaDB 5.5 and above is compiled using cmake.

It is recommended to create a build directory beside your source directory

mkdir build-mariadb
cd build-mariadb

You can configure your build simply by running cmake without any special options, like

cmake ../server

where server is where you installed MariaDB. If you want it to be configured exactly as we do for our releases, use

cmake ../server -DBUILD_CONFIG=mysql_release

All cmake configuration options for MariaDB can be displayed with:

cmake ../server -LH

To build and install MariaDB after running cmake use

make
sudo make install

If the commands above fail, you can enable more compilation information by doing:

make VERBOSE=1

Starting MariaDB for the first time

After installing MariaDB (using sudo make install), but prior to starting MariaDB for the first time, one should:

  1. ensure the directory where you installed MariaDB 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/
cd /usr/local/mysql/
scripts/mysql_install_db --user=mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql &

Testing MariaDB

If you want to test your compiled MariaDB, you can do either of:

make test

or

mysql-test/mysql-test-run --force

Each of the above are run from the source directory. There is no need to 'sudo make install' MariaDB prior to running them.

NOTE: If you are doing more extensive testing or debugging of MariaDB (like with real application data and workloads) you may want to start and run MariaDB directly from the source directory instead of installing it with 'sudo make install'. If so, see Running MariaDB from the Source Directory.

Increasing version number or tagging a version

If you have made code changes and want to increase the version number or tag our version with a specific tag you can do this by editing the VERSION file. Tags are shown when running the 'mysqld --version' command.

Non-ascii symbols

MariaDB builds with readline; using an alternative such as Editline may result in problems with non-ascii symbols.

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.