This section discusses how to install MySQL from the latest development source code. Development trees have not necessarily received the same level of testing as standard release distributions, so this installation method is usually required only if you need the most recent code changes. Do not use a development tree for production systems. If your goal is simply to get MySQL up and running on your system, you should use a standard release distribution (either a binary or source distribution). See Section 2.1.3, “How to Get MySQL”.
To obtain the source tree, you must have Bazaar installed. The Bazaar VCS Web site has instructions for downloading and installing Bazaar on different platforms. Bazaar is supported on any platform that supports Python, and is therefore compatible with any Linux, Unix, Windows, or Mac OS X host.
MySQL development projects are hosted on Launchpad. MySQL projects, including MySQL Server, MySQL Workbench, and others are available from the Oracle/MySQL Engineering page. For the repositories related only to MySQL Server, see the MySQL Server page.
To build under Unix/Linux, you must have the following tools installed:
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/.
autoconf 2.58 (or newer), available from http://www.gnu.org/software/autoconf/.
automake 1.8.1, available from http://www.gnu.org/software/automake/.
libtool 1.5, available from http://www.gnu.org/software/libtool/. 1.5.24 or later is recommended.
m4, available from http://www.gnu.org/software/m4/.
bison, available from http://www.gnu.org/software/bison/. You should use the latest version of bison where possible. Versions 1.75 and 2.1 are known to work. There have been reported problems with bison 1.875. If you experience problems, upgrade to a later, rather than earlier, version. Versions of bison older than 1.75 may report this error:
sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
The maximum table size is not actually exceeded; the error is caused by bugs in older versions of bison.
To build under Windows you must have Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
Once the necessary tools are installed, create a local branch of the MySQL development tree on your machine using this procedure:
To obtain a copy of the MySQL source code, you must create a new Bazaar branch. If you do not already have a Bazaar repository directory set up, you must initialize a new directory:
bzr init-repo --trees mysql-server
This is a one-time operation.
Assuming that you have an initialized repository directory, you can branch from the public MySQL server repositories to create a local source tree. To create a branch of a specific version:
bzr branch lp:mysql-server/4.1 mysql-4.1
This is a one-time operation per source tree. You can branch
the source trees for several versions of MySQL under the
The initial download will take some time to complete, depending on the speed of your connection. Please be patient. Once you have downloaded the first tree, additional trees should take significantly less time to download.
When building from the Bazaar branch, you may want to create a copy of your active branch so that you can make configuration and other changes without affecting the original branch contents. You can achieve this by branching from the original branch:
bzr branch mysql-4.1 mysql-4.1-build
To obtain changes made after you have set up the branch
initially, update it using the
periodically. Use this command in the top-level directory of
the local copy:
You can examine the changeset comments for the tree by using
log option to bzr:
shell> bzr log
You can also browse changesets, comments, and source code online at the Launchpad MySQL Server page.
If you see diffs (changes) or code that you have a question
about, do not hesitate to send email to the MySQL
internals mailing list. See
Section 1.7.1, “MySQL Mailing Lists”. If you think you have a
better idea on how to do something, send an email message to
the list with a patch.
After you have the local branch, you can build MySQL server from the source code. On Windows, the build process is different from Unix/Linux: see Section 2.9.7, “Installing MySQL from Source on Windows”.
On Unix/Linux, use the autoconf system to create the configure script so that you can configure the build environment before building. The following example shows the typical commands required to build MySQL from a source tree.
Change location to the top-level directory of the source tree;
mysql-4.1 with the
appropriate directory name.
Prepare the source tree for configuration.
You must separately configure the
InnoDB storage engines. Run the following
commands from the main source directory:
(cd bdb/dist; sh s_all)shell>
(cd innobase; autoreconf --force --install)
You can omit the previous commands if you do not require
Prepare the remainder of the source tree:
autoreconf --force --install
As an alternative to the preceding autoreconf command, you can use BUILD/autorun.sh, which acts as a shortcut for the following sequence of commands:
libtoolize --automake --forceshell>
automake --force --add-missing; autoconfshell>
(cd bdb/dist; sh s_all)shell>
(cd innobase; aclocal; autoheader; autoconf; automake)
If you get some strange errors during this stage, verify that you have the correct version of libtool installed.
Configure the source tree and compile MySQL:
./configure # Add your favorite options hereshell>
For a description of some configure options, see Section 2.9.3, “MySQL Source-Configuration Options”.
A collection of configuration scripts is located in the
BUILD/ subdirectory. For example, you may
find it more convenient to use the
BUILD/compile-pentium-debug script than
the preceding set of shell commands. To compile on a different
architecture, modify the script by removing flags that are
Pentium-specific, or use another script that may be more
appropriate. These scripts are provided on an
“as-is” basis. They are not supported and their
contents may change from release to release.
When the build is done, run make install.
Be careful with this on a production machine; the installation
command may overwrite your live release installation. If you
already have MySQL installed and do not want to overwrite it,
run ./configure with values for the
options different from those used by your production server.
For additional information about preventing multiple servers
from interfering with each other, see
Section 5.7, “Running Multiple MySQL Servers on the Same Machine”.
Play hard with your new installation. For example, try to make new features crash. Start by running make test. See Section 18.1.2, “The MySQL Test Suite”.
If you have gotten to the make stage, but
the distribution does not compile, please enter the problem
into our bugs database using the instructions given in
Section 1.8, “How to Report Bugs or Problems”. If you have installed the
latest versions of the required tools, and they crash trying
to process our configuration files, please report that also.
However, if you get a
command not found
error or a similar problem for required tools, do not report
it. Instead, make sure that all the required tools are
installed and that your
PATH variable is
set correctly so that your shell can find them.