First, get a copy of the MariaDB source.
If you don't want to run MariaDB as yourself, then you should create a
mysql user. The example below uses this user.
MariaDB starting with 5.5
MariaDB 5.5 and above is compiled using cmake. You can configure your build simply by running cmake without any special options, like
but if you want it to be configured exactly as we do for our releases, use
cmake . -DBUILD_CONFIG=mysql_release
All cmake configuration options for MariaDB can be displayed with:
cmake . -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:
MariaDB until 5.3
Building MariaDB with the BUILD scripts
The easiest way of building MariaDB would be to use the appropriate BUILD script that matches your configuration. For example:
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
There are many different BUILD scripts which cover many different configurations and processor architectures.
To see what a build scripts does, you can run it with the
After building MariaDB with a BUILD script, install MariaDB with:
sudo make install
Building MariaDB Manually
If there is no appropriate script, you can also execute the build commands directly:
cd $maria-source-dir # ex: ~/repos/maria/trunk BUILD/autorun.sh ./configure make sudo make install
Max builds configure line
The following configure line is the one we used to 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:
Starting MariaDB for the first time
After installing MariaDB (using
sudo make install), but prior to starting MariaDB for the first time, one should:
- 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)
- run the
mysql_install_dbscript 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 &
If you want to test your compiled MariaDB, you can do either of:
cd 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.