The configure script provides a great deal of control over how you configure a MySQL source distribution. Typically, you do this using options on the configure command line. For a full list of options supported by configure, run this command:
You can also affect configure using certain environment variables. See Section 2.13, “Environment Variables”.
Some of the configure options available are described here. For options that may be of use if you have difficulties building MySQL, see Section 2.9.4, “Dealing with Problems Compiling MySQL”.
Many options configure compile-time defaults that can be
overridden at server startup. For example, the
that configure the default installation base directory location,
TCP/IP port number, and Unix socket file can be changed at server
startup with the
--socket options for
To compile just the MySQL client libraries and client programs
and not the server, use the
If you have no C++ compiler, some client programs such as
mysql cannot be compiled because they
require C++. In this case, you can remove the code in
configure that tests for the C++ compiler
and then run ./configure with the
--without-server option. The
compile step should still try to build all clients, but you
can ignore any warnings about files such as
mysql.cc. (If make
stops, try make -k to tell it to continue
with the rest of the build even if errors occur.)
To build the embedded MySQL library
libmysqld.a), use the
./configure --prefix=/usr/local \
The first command changes the installation prefix so that
everything is installed under
/usr/local/mysql rather than the default
/usr/local. The second command
preserves the default installation prefix, but overrides the
default location for database directories (normally
/usr/local/var) and changes it to
You can also specify the installation directory and data
directory locations at server startup time by using the
--datadir options. These can be
given on the command line or in an MySQL option file, although
it is more common to use an option file. See
Section 184.108.40.206, “Using Option Files”.
specifies the port number on which the server listens for
TCP/IP connections. The default is port 3306. To listen on a
different port, use a configure command
The socket file name must be an absolute path name. You can
also change the location of
server startup by using a MySQL option file. See
Section B.5.4.5, “How to Protect or Change the MySQL Unix Socket File”.
To compile statically linked programs (for example, to make a binary distribution, to get better performance, or to work around problems with some Red Hat Linux distributions), run configure like this:
./configure --with-client-ldflags=-all-static \
CC=gcc CXX=gcc ./configure
When you use gcc as your C++ compiler, it
does not attempt to link in
libstdc++. This may be a good thing to do
even if you have those libraries installed. Some versions of
them have caused strange problems for MySQL users in the past.
The following list indicates some compilers and environment variable settings that are commonly used with each one.
CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \ -felide-constructors -fno-exceptions -fno-rtti"
In most cases, you can get a reasonably optimized MySQL binary by using the options from the preceding list and adding the following options to the configure line:
--prefix=/usr/local/mysql --enable-assembler \ --with-mysqld-ldflags=-all-static
The full configure line would, in other words, be something like the following for all recent gcc versions:
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \ -felide-constructors -fno-exceptions -fno-rtti" ./configure \ --prefix=/usr/local/mysql --enable-assembler \ --with-mysqld-ldflags=-all-static
The binaries we provide on the MySQL Web site at http://dev.mysql.com/downloads/ are all compiled with full optimization and should work well for most users. See Section 2.8, “Installing MySQL from Generic Binaries on Other Unix-Like Systems”.
If the build fails and produces errors about your compiler or
linker not being able to create the shared library
N is a version number), you
can work around this problem by giving the
--disable-shared option to
configure. In this case,
configure does not build a shared
By default, MySQL uses the
West European) character set. To change the default set, use
CHARSET may be one of
(Additional character sets might be available. Check the
output from ./configure --help for the
As of MySQL 4.1.1, the default collation may also be
specified. MySQL uses the
collation. To change this, use the
To change both the character set and the collation, use both
The collation must be a legal collation for the character set.
statement to determine which collations are available for each
Before MySQL 4.1, if you change character sets after having
created any tables, you have to run myisamchk -r -q
MyISAM table. Your indexes may
be sorted incorrectly otherwise. This can happen if you
install MySQL, create some tables, and then reconfigure
MySQL to use a different character set and reinstall it.
With the configure option
you can define which additional character sets should be
compiled into the server.
one of the following:
A list of character set names separated by spaces
complex to include all character sets
that can't be dynamically loaded
all to include all character sets into
Clients that want to convert characters between the server and
the client should use the
statement. See Section 9.1.4, “Connection Character Sets and Collations”.
To configure MySQL with debugging code, use the
This causes a safe memory allocator to be included that can find some errors and that provides output about what is happening. See Section 18.4, “Porting to Other Systems”.
If your client programs are using threads, you must compile a
thread-safe version of the MySQL client library with the
configure option. This creates a
libmysqlclient_r library with which you
should link your threaded applications. See
Section 220.127.116.11, “Writing C API Threaded Client Programs”.
Some features require that the server be built with
compression library support, such as the
UNCOMPRESS() functions, and
compression of the client/server protocol. The
option provides control over compression library support. The
no explicitly disables compression
bundled causes the
zlib library bundled in the MySQL sources
to be used. A
DIR path name
specifies the directory in which to find the compression
It is possible to build MySQL with big table support using the
beginning with the following MySQL versions:
4.0 series: 4.0.25
4.1 series: 4.1.11
This option causes the variables that store table row counts
to be declared as
unsigned long long rather
unsigned long. This enables tables to
hold up to approximately 1.844E+19
rows rather than 232 (~4.295E+09)
rows. Previously it was necessary to pass
-DBIG_TABLES to the compiler manually in
order to enable this feature.
See Section 2.12, “Operating System-Specific Notes”, for options that pertain to particular operating systems.
See Section 18.104.22.168, “Using SSL Connections”, for options that pertain to configuring MySQL to support secure (encrypted) connections.