2.17 Installing MySQL from Source

2.17.1 Installing MySQL Using a Standard Source Distribution
2.17.2 Installing MySQL Using a Development Source Tree
2.17.3 MySQL Source-Configuration Options
2.17.4 Dealing with Problems Compiling MySQL
2.17.5 Compiling and Linking an Optimized mysqld Server

Building MySQL from the source code enables you to customize build parameters, compiler optimizations, and installation location. For a list of systems on which MySQL is known to run, see http://www.mysql.com/support/supportedplatforms/database.html.

Before you proceed with an installation from source, check whether we produce a precompiled binary distribution for your platform and whether it works for you. We put a great deal of effort into ensuring that our binaries are built with the best possible options for optimal performance. Instructions for installing binary distributions are available in Section 2.16, “Installing MySQL on Unix/Linux Using Generic Binaries”.

To obtain a source distribution for MySQL, see Section 2.5, “How to Get MySQL”. MySQL source distributions are available as compressed tar files, Zip archives, or RPM packages. Distribution files have names of the form mysql-VERSION.tar.gz, mysql-VERSION.zip, or mysql-VERSION.rpm, where VERSION is a number like 5.0.96.

To perform a MySQL installation using the source code:

To install MySQL from source, your system must have the following tools:

If you are using a version of gcc recent enough to understand the -fno-exceptions option, it is very important that you use this option. Otherwise, you may compile a binary that crashes randomly. Also use -felide-constructors and -fno-rtti along with -fno-exceptions. When in doubt, do the following:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
       -fno-exceptions -fno-rtti" ./configure \
       --prefix=/usr/local/mysql --enable-assembler \

On most systems, this gives you a fast and stable binary.

If you run into problems and need to file a bug report, please use the instructions in Section 1.7, “How to Report Bugs or Problems”.