This section does not apply to MySQL Enterprise Server users.
The configure script gives you a great deal of control over how you configure a MySQL source distribution. Typically you do this using options on the configure command line. You can also affect configure using certain environment variables. See Section 2.4.20, “Environment Variables”. For a full list of options supported by configure, run this command:
shell> ./configure --help
A list of the available configure options is provided in the table below.
Table 2.1. Build (configure) Reference
| Formats | Description | Default | Introduced | Removed |
|---|---|---|---|---|
| --bindir=DIR | User executables | EPREFIX/bin | ||
| --build=BUILD | Configure for building on BUILD | guessed | ||
| --cache-file=FILE | Cache test results in FILE | disabled | ||
| -C | Alias for `--cache-file=config.cache' | |||
| --config-cache | ||||
| --datadir=DIR | Read-only architecture-independent data | PREFIX/share | ||
| --disable-FEATURE | Do not include FEATURE | |||
| --disable-dependency-tracking | Disable dependency tracking | |||
| --disable-grant-options | Disable GRANT options | 5.0.34 | ||
| --disable-largefile | Omit support for large files | |||
| --disable-libtool-lock | Disable libtool lock | |||
| --disable-profiling | Build a version without query profiling code | 5.0.37 | 5.0.45 | |
| --enable-FEATURE | Enable FEATURE | |||
| --enable-assembler | Use assembler versions of some string functions if available | |||
| --enable-dependency-tracking | Do not reject slow dependency extractors | |||
| --enable-fast-install | Optimize for fast installation | yes | ||
| --enable-local-infile | Enable LOAD DATA LOCAL INFILE | disabled | ||
| --enable-shared | Build shared libraries | yes | ||
| --enable-static | Build static libraries | yes | ||
| --enable-thread-safe-client | Compile the client with threads | |||
| --exec-prefix=EPREFIX | Install architecture-dependent files in EPREFIX | |||
| -h | Display this help and exit | |||
| --help | ||||
| --help=short | Display options specific to this package | |||
| --help=recursive | Display the short help of all the included packages | |||
| --host=HOST | Cross-compile to build programs to run on HOST | |||
| --includedir=DIR | C header files | PREFIX/include | ||
| --infodir=DIR | Info documentation | PREFIX/info | ||
| --libdir=DIR | Object code libraries | EPREFIX/lib | ||
| --libexecdir=DIR | Program executables | EPREFIX/libexec | ||
| --localstatedir=DIR | Modifiable single-machine data | PREFIX/var | ||
| --mandir=DIR | man documentation | PREFIX/man | ||
| -n | Do not create output files | |||
| --no-create | ||||
| --oldincludedir=DIR | C header files for non-gcc | /usr/include | ||
| --prefix=PREFIX | Install architecture-independent files in PREFIX | |||
| --program-prefix=PREFIX | Prepend PREFIX to installed program names | |||
| --program-suffix=SUFFIX | Append SUFFIX to installed program names | |||
| --program-transform-name=PROGRAM | run sed PROGRAM on installed program names | |||
| -q | Do not print `checking...' messages | |||
| --quiet | ||||
| --sbindir=DIR | System admin executables | EPREFIX/sbin | ||
| --sharedstatedir=DIR | Modifiable architecture-independent data | PREFIX/com | ||
| --srcdir=DIR | Find the sources in DIR | configure directory or .. | ||
| --sysconfdir=DIR | Read-only single-machine data | PREFIX/etc | ||
| --target=TARGET | Configure for building compilers for TARGET | |||
| -V | Display version information and exit | |||
| --version | ||||
| --with-PACKAGE | Use PACKAGE | |||
| --with-archive-storage-engine | Enable the Archive Storage Engine | no | ||
| --with-berkeley-db | Use BerkeleyDB located in DIR | no | ||
| --with-berkeley-db-includes | Find Berkeley DB headers in DIR | |||
| --with-berkeley-db-libs | Find Berkeley DB libraries in DIR | |||
| --with-big-tables | Support tables with more than 4 G rows even on 32 bit platforms | 5.0.4 | ||
| --with-blackhole-storage-engine | Enable the Blackhole Storage Engine | no | 5.0.4 | |
| --with-charset | Default character set | |||
| --with-client-ldflags | Extra linking arguments for clients | |||
| --with-collation | Default collation | |||
| --with-comment | Comment about compilation environment | |||
| --with-csv-storage-engine | Enable the CSV Storage Engine | yes | ||
| --with-darwin-mwcc | Use Metrowerks CodeWarrior wrappers on OS X/Darwin | 5.0.6 | ||
| --with-embedded-privilege-control | Build parts to check user's privileges (only affects embedded library) | |||
| --with-embedded-server | Build the embedded server | |||
| --with-example-storage-engine | Enable the Example Storage Engine | no | ||
| --with-extra-charsets | Use charsets in addition to default | |||
| --with-gnu-ld | Assume the C compiler uses GNU ld | no | ||
| --with-isam | Enable the ISAM table type | |||
| --with-lib-ccflags | Extra CC options for libraries | |||
| --with-libwrap=DIR | Compile in libwrap (tcp_wrappers) support | |||
| --with-low-memory | Try to use less memory to compile to avoid memory limitations | |||
| --with-machine-type | Set the machine type, like "powerpc" | 5.0.44 | ||
| --with-max-indexes=N | Sets the maximum number of indexes per table | 64 | ||
| --with-mit-threads | Always use included thread lib | |||
| --with-mysqld-ldflags | Extra linking arguments for mysqld | |||
| --with-mysqld-libs | Extra libraries to link with for mysqld | 5.0.44 | ||
| --with-mysqld-user | What user the mysqld daemon shall be run as | |||
| --with-mysqlfs | Include the corba-based MySQL file system | |||
| --with-mysqlmanager | Build the mysqlmanager binary | Build if server is built | ||
| --with-named-curses-libs | Use specified curses libraries | |||
| --with-named-thread-libs | Use specified thread libraries | |||
| --with-ndb-ccflags | Extra CC options for ndb compile | 5.0.3 | ||
| --with-ndb-docs | Include the NDB Cluster ndbapi and mgmapi documentation | |||
| --with-ndb-port | Port for NDB Cluster management server | |||
| --with-ndb-port-base | Port for NDB Cluster management server | 5.0.3 | ||
| --with-ndb-sci=DIR | Provide MySQL with a custom location of sci library | |||
| --with-ndb-shm | Include the NDB Cluster shared memory transporter | |||
| --with-ndb-test | Include the NDB Cluster ndbapi test programs | |||
| --with-ndbcluster | Include the NDB Cluster table handler | no | ||
| --with-openssl=DIR | Include the OpenSSL support | |||
| --with-openssl-includes | Find OpenSSL headers in DIR | |||
| --with-openssl-libs | Find OpenSSL libraries in DIR | |||
| --with-other-libc=DIR | Link against libc and other standard libraries installed in the specified non-standard location | |||
| --with-pic | Try to use only PIC/non-PIC objects | Use both | ||
| --with-pstack | Use the pstack backtrace library | |||
| --with-pthread | Force use of pthread library | |||
| --with-raid | Enable RAID Support | |||
| --with-server-suffix | Append value to the version string | |||
| --with-system-type | Set the system type, like "sun-solaris10" | 5.0.44 | ||
| --with-tags | Include additional configurations | automatic | ||
| --with-tcp-port | Which port to use for MySQL services | 3306 | ||
| --with-unix-socket-path | Where to put the unix-domain socket | |||
| --with-vio | Include the Virtual IO support | |||
| --with-yassl | Include the yaSSL support | 5.0.6 | ||
| --with-zlib-dir=no|bundled|DIR | Provide MySQL with a custom location of compression library | |||
| --without-PACKAGE | Do not use PACKAGE | |||
| --without-bench | Skip building of the benchmark suite | |||
| --without-debug | Build a production version without debugging code | |||
| --without-docs | Skip building of the documentation | |||
| --without-extra-tools | Skip building utilites in the tools directory | |||
| --without-geometry | Do not build geometry-related parts | |||
| --without-innodb | Do not include the InnoDB table handler | |||
| --without-libedit | Use system libedit instead of bundled copy | |||
| --without-man | Skip building of the man pages | |||
| --without-ndb-debug | Disable special ndb debug features | 5.0.3 | ||
| --without-query-cache | Do not build query cache | |||
| --without-readline | Use system readline instead of bundled copy | |||
| --without-server | Only build the client | |||
| --without-uca | Skip building of the national Unicode collations | 5.0.3 |
Some of the configure options available are described here:
To compile just the MySQL client libraries and client
programs and not the server, use the
--without-server option:
shell> ./configure --without-server
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.)
If you want to build the embedded MySQL library
(libmysqld.a), use the
--with-embedded-server option.
If you don't want your log files and database directories
located under /usr/local/var, use a
configure command something like one of
these:
shell>./configure --prefix=/usr/local/mysqlshell>./configure --prefix=/usr/local \--localstatedir=/usr/local/mysql/data
The first command changes the installation prefix so that
everything is installed under
/usr/local/mysql rather than the
default of /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 /usr/local/mysql/data.
You can also specify the installation directory and data
directory locations at server startup time by using the
--basedir and --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 4.2.3.2, “Using Option Files”.
If you are using Unix and you want the MySQL socket file
location to be somewhere other than the default location
(normally in the directory /tmp or
/var/run), use a
configure command like this:
shell>./configure \--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
The socket filename must be an absolute pathname. You can
also change the location of mysql.sock
at server startup by using a MySQL option file. See
Section B.1.4.5, “How to Protect or Change the MySQL Unix Socket File”.
If you want 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:
shell>./configure --with-client-ldflags=-all-static \--with-mysqld-ldflags=-all-static
If you are using gcc and don't have
libg++ or libstdc++
installed, you can tell configure to use
gcc as your C++ compiler:
shell> CC=gcc CXX=gcc ./configure
When you use gcc as your C++ compiler, it
does not attempt to link in libg++ or
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.
gcc 2.7.2:
CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
gcc 2.95.2:
CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \ -felide-constructors -fno-exceptions -fno-rtti"
pgcc 2.90.29 or newer:
CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \ CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \ -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 be perfect for most users. See Section 2.4.3.4, “MySQL Binaries Compiled by MySQL AB”. There are some configuration settings you can tweak to build an even faster binary, but these are only for advanced users. See Section 7.5.6, “How Compiling and Linking Affects the Speed of MySQL”.
If the build fails and produces errors about your compiler
or linker not being able to create the shared library
libmysqlclient.so.
(where NN 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
libmysqlclient.so.
library.
N
By default, MySQL uses the latin1 (cp1252
West European) character set. To change the default set, use
the --with-charset option:
shell> ./configure --with-charset=CHARSET
CHARSET may be one of
binary, armscii8,
ascii, big5,
cp1250, cp1251,
cp1256, cp1257,
cp850, cp852,
cp866, cp932,
dec8, eucjpms,
euckr, gb2312,
gbk, geostd8,
greek, hebrew,
hp8, keybcs2,
koi8r, koi8u,
latin1, latin2,
latin5, latin7,
macce, macroman,
sjis, swe7,
tis620, ucs2,
ujis, utf8. See
Section 9.2, “The Character Set Used for Data and Sorting”. (Additional
character sets might be available. Check the output from
./configure --help for the current list.)
The default collation may also be specified. MySQL uses the
latin1_swedish_ci collation by default.
To change this, use the --with-collation
option:
shell> ./configure --with-collation=COLLATION
To change both the character set and the collation, use both
the --with-charset and
--with-collation options. The collation
must be a legal collation for the character set. (Use the
SHOW COLLATION statement to determine
which collations are available for each character set.)
If you change character sets after having created any
tables, you must run myisamchk -r -q
--set-collation=collation_name
on every 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
--with-extra-charsets=,
you can define which additional character sets should be
compiled into the server. LISTLIST is
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 the binaries
Clients that want to convert characters between the server
and the client should use the SET NAMES
statement. See Section 12.5.3, “SET Syntax”, and
Section 9.1.4, “Connection Character Sets and Collations”.
To configure MySQL with debugging code, use the
--with-debug option:
shell> ./configure --with-debug
This causes a safe memory allocator to be included that can find some errors and that provides output about what is happening. See MySQL Internals: Porting.
As of MySQL 5.0.25, using --with-debug to
configure MySQL with debugging support enables you to use
the --debug="d,parser_debug" option when
you start the server. This causes the Bison parser that is
used to process SQL statements to dump a parser trace to the
server's standard error output. Typically, this output is
written to the error log.
If your client programs are using threads, you must compile
a thread-safe version of the MySQL client library with the
--enable-thread-safe-client configure
option. This creates a libmysqlclient_r
library with which you should link your threaded
applications. See Section 26.2.16, “How to Make a Threaded Client”.
Some features require that the server be built with
compression library support, such as the
COMPRESS() and
UNCOMPRESS() functions, and
compression of the client/server protocol. The
--with-zlib-dir=no|bundled|
option provides control for compression library support. The
value DIRno explicitly disables compression
support. bundled causes the
zlib library bundled in the MySQL sources
to be used. A DIR pathname
specifies where to find the compression library sources.
It is possible to build MySQL 5.0 with large
table support using the --with-big-tables
option, beginning with MySQL 5.0.4.
This option causes the variables that store table row counts
to be declared as unsigned long long
rather than unsigned long. This enables
tables to hold up to approximately 1.844E+19
((232)2)
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.
Run configure with the
--disable-grant-options option to cause the
the --bootstrap,
--skip-grant-tables, and
--init-file options for
mysqld to be disabled. For Windows, the
configure.js script recognizes the
DISABLE_GRANT_OPTIONS flag, which has the
same effect. The capability is available as of MySQL 5.0.34.
In MySQL Community Server, this option enables the statement
profiling capability exposed by the SHOW
PROFILE and SHOW PROFILES
statements. (See Section 12.5.4.25, “SHOW PROFILES and SHOW PROFILE
Syntax”.) The
option was added in MySQL 5.0.37.
See Section 2.4.19, “Operating System-Specific Notes”, for options that pertain to particular operating systems.
See Section 5.5.7.2, “Using SSL Connections”, for options that pertain to configuring MySQL to support secure (encrypted) connections.

User Comments
For all who had the same Prolem like me :
If you get some error like this :
No curses/termcap library found
configure you're Source Distribution with the
option --with-named-curses-
libs=/your/path/to/lib/libncurses.so.5.0
Best Regards DaPhreak
If you get an error like Internal Compiler Error
Send a bug to gnu.gcc ...
Try running the previous command(step) with out
-O3 option ..This is a compiler optimisation option...
Regards,
Ram.
Just some info about the option "mpentiumpro" and "03":
gcc: unrecognized option `-03' (see last note)
`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mcpu=pentiumpro' instead.
I have a gcc version: gcc (GCC) 3.3.6
make version: GNU Make 3.80
(fresh out of the box slackware 10.2)
If you can not compile using --with-debug, do a "make distclean" before running make.
Note that -O3 is "minus O 3" not "minus zero 3"
The O stands for optimisation and the biger the number, the more optimised. However, anything over 3 is almost certain to give broken binaries. 2 is usualy a safe compromise.
-march will give you a binary only compatible for the specified CPU while -mcpu will give a binary compatible with all cpus but optimised for the one specified.
This is especialy important for the difference between amd and intel cpu, or if using the binary on a CPU of a previous generation. For exemple, if you optimise for a Pentium 3 and try to run on a pentium 2, it will work if you use -mcpu, but not if you used -march
You might want to look at the gcc doc before using those options.
Add your own comment.