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 Installing MySQL on Unix/Linux Using Generic Binaries.
To obtain a source distribution for MySQL, see
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
VERSION is a number like
To perform a MySQL installation using the source code:
To build MySQL from source on Unix-like systems, including
Linux, commercial Unix, BSD, Mac OS X and others using a
.tar.gz or RPM-based source code
Chapter 2, Installing MySQL Using a Standard Source Distribution.
To build MySQL from source on Windows (Windows XP or newer required), see Chapter 6, Installing MySQL from Source on Windows.
For information on building from one of our development trees, see Chapter 3, Installing MySQL Using a Development Source Tree.
For information on using the configure command to specify the source build parameters, including links to platform specific parameters that you might need, see Chapter 4, MySQL Source-Configuration Options.
To install MySQL from source, your system must have the following tools:
gunzip to uncompress the distribution and
a reasonable tar to unpack it (if you use a
.tar.gz distribution), or
WinZip or another tool that can read
.zip files (if you use a
GNU tar is known to work. The standard
tar provided with some operating systems is
not able to unpack the long file names in the MySQL
distribution. You should download and install GNU
tar, or if available, use a preinstalled
version of GNU tar. Usually this is available as
gnutar, gtar, or as
tar within a GNU or Free Software directory,
/usr/local/bin. GNU tar
is available from
A working ANSI C++ compiler. GCC 3.4.6 or later, Sun Studio 10 or later, Visual Studio 2005 or later, and many current vendor-supplied compilers are known to work.
A good make program. Although some platforms come with their own make implementations, it is highly recommended that you use GNU make 3.75 or newer. It may already be available on your system as gmake. GNU make is available from http://www.gnu.org/software/make/.
libtool 1.5, available from http://www.gnu.org/software/libtool/. 1.5.24 or later is recommended.
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
-fno-exceptions. When in doubt, do the
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \ -fno-exceptions -fno-rtti" ./configure \ --prefix=/usr/local/mysql --enable-assembler \ --with-mysqld-ldflags=-all-static
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 How to Report Bugs or Problems.