You should read this section only if you are interested in helping us test our new code. If you just want to get MySQL up and running on your system, you should use a standard release distribution (either a binary or source distribution).
To obtain the most recent development source tree, you first need to download and install Bazaar. You can obtain Bazaar from the Bazaar VCS Website. Bazaar is supported by any platform that supports Python, and is therefore compatible with any Linux, Unix, Windows or Mac OS X host. Instructions for downloading and installing Bazaar on the different platforms are available on the Bazaar website.
All MySQL projects are hosted on Launchpad. MySQL projects, including MySQL server, MySQL Workbench and others are available from the Sun/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:
GNU make, available from http://www.gnu.org/software/make/. Although some platforms come with their own make implementations, it is highly recommended that you use GNU make. It may already be available on your system as gmake.
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/.
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. Version 1.75 and version 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 will need a copy of Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
Once you have the necessary tools installed, you first need to create a local branch of the MySQL source code on your machine:
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 need to initialize a new directory:
shell>mkdir mysql-server
shell>bzr init-repo --trees mysql-server
Once you have an initialized directory, you can
branch
from the public MySQL server
repositories. To create a branch of a specific version:
shell>cd mysql-server
shell>bzr branch lp:mysql-server/5.1 mysql-5.1
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:
shell> bzr branch mysql-5.1 mysql-5.1-build
Once you have the local branch, you can start to build MySQL server from the source code. On Windows, the build process is different from Unix/Linux. To continue building MySQL on Windows, see Section 2.10.6, “Installing MySQL from Source on Windows”.
On Unix/Linux you need to 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
configure a source tree. The first cd
command changes location into the top-level directory of the
tree; replace mysql-5.1
with the appropriate directory name.
For MySQL 5.1.12 and earlier, you must separately
configure the INNODB
storage engine.
You can do this by running the following command from the
main source directory:
shell> (cd storage/innobase; autoreconf --force --install)
shell>cd mysql-5.1
shell>autoreconf --force --install
shell>./configure # Add your favorite options here
shell>make
Or you can use BUILD/autorun.sh as a shortcut for the following sequence of commands:
shell>aclocal; autoheader
shell>libtoolize --automake --force
shell>automake --force --add-missing; autoconf
The command line that changes directory into the
storage/innobase
directory is used to
configure the InnoDB
storage engine. You
can omit this lines if you do not require
InnoDB
support.
Beginning with MySQL 5.1, code specific to storage engines
has been moved under a storage
directory. For example, InnoDB
code is
now found in storage/innobase
and
NDBCLUSTER
code is in
storage/ndb
.
If you get some strange errors during this stage, verify that you have the correct version of the libtool installed.
A collection of our standard 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 officially
maintained 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 command
may overwrite your live release installation. If you have
another installation of MySQL, run
./configure with different values for the
--prefix
,
--with-tcp-port
, and
--with-unix-socket-path
options than those used for your production server.
Play hard with your new installation and try to make the new features crash. Start by running make test. See Section 21.1.2, “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.6, “How to Report Bugs or Problems”. If you have installed the
latest versions of the required GNU tools, and they crash
trying to process our configuration files, please report
that also. However, if you execute
aclocal
and get a command not
found
error or a similar problem, do not report
it. Instead, make sure that all the necessary tools are
installed and that your PATH
variable is
set correctly so that your shell can find them.
After initially copying the repository with bzr to obtain the source tree, you should use pull option to periodically update your local copy. To do this any time after you have set up the repository, use this command:
shell> bzr pull
You can examine the changeset comments for the tree by using
the log
option to bzr:
shell> bzr log
You can also browse changesets, comments, and source code online. To browse this information for MySQL 5.1, go to http://launchpad.net/mysql-server/.
If you see diffs or code that you have a question about, do
not hesitate to send email to the MySQL
internals
mailing list. See
Section 1.5.1, “MySQL Mailing Lists”. Also, if you think you have
a better idea on how to do something, send an email message
to the list with a patch.
User Comments
When compiling under Cygwin, by default, it uses automake-1.4, which it considers to be the "stable" version. In the Cygwin bash shell, cd into /etc/alternatives. Inside this directory, make sure to re-link the symlinks "aclocal" and "automake" to "/usr/bin/aclocal-1.9" and "/usr/bin/automake-1.9", respectively.
If you develop UI, probably you have ncurses-devel installed. If not, install it before you configure. The included curses termcap library needed for configure.
Watch out for ./BUILD/autorun.sh running an old instance libtoolize named glibtoolize. My system had an old glibtoolize 1.5 that become selected before libtoolize 1.5.23, causing the built to break.
Add your own comment.