2.9.4 MySQL Source-Configuration Options

The CMake program provides a great deal of control over how you configure a MySQL source distribution. Typically, you do this using options on the CMake command line. For information about options supported by CMake, run either of these commands in the top-level source directory:

shell> cmake . -LH
shell> ccmake .

You can also affect CMake using certain environment variables. See Section 2.12, “Environment Variables”.

The following table shows the available CMake options. In the Default column, PREFIX stands for the value of the CMAKE_INSTALL_PREFIX option, which specifies the installation base directory. This value is used as the parent location for several of the installation subdirectories.

Table 2.16 MySQL Source-Configuration Option Reference (CMake)

BUILD_CONFIG Use same build options as official releases 5.5.7 
CMAKE_BUILD_TYPE Type of build to produce RelWithDebInfo5.5.7 
CMAKE_C_FLAGS Flags for C Compiler   
CMAKE_CXX_FLAGS Flags for C++ Compiler   
CMAKE_INSTALL_PREFIX Installation base directory /usr/local/mysql5.5.8 
COMPILATION_COMMENT Comment about compilation environment 5.5.7 
CPACK_MONOLITHIC_INSTALL Whether package build produces single file OFF5.5.7 
DEFAULT_CHARSET The default server character set latin15.5.7 
DEFAULT_COLLATION The default server collation latin1_swedish_ci5.5.7 
ENABLE_DEBUG_SYNC Whether to enable Debug Sync support ON5.5.7 
ENABLE_DOWNLOADS Whether to download optional files OFF5.5.7 
ENABLE_DTRACE Whether to include DTrace support 5.5.7 
ENABLE_GCOV Whether to include gcov support 5.5.14 
ENABLED_PROFILING Whether to enable query profiling code ON5.5.7 
IGNORE_AIO_CHECK With -DBUILD_CONFIG=mysql_release, ignore libaio check OFF5.5.9 
INSTALL_BINDIR User executables directory PREFIX/bin5.5.7 
INSTALL_DOCDIR Documentation directory PREFIX/docs5.5.7 
INSTALL_INCLUDEDIR Header file directory PREFIX/include5.5.7 
INSTALL_INFODIR Info file directory PREFIX/docs5.5.7 
INSTALL_LAYOUT Select predefined installation layout STANDALONE5.5.7 
INSTALL_LIBDIR Library file directory PREFIX/lib5.5.7 
INSTALL_MANDIR Manual page directory PREFIX/man5.5.7 
INSTALL_MYSQLSHAREDIR Shared data directory PREFIX/share5.5.7 
INSTALL_MYSQLTESTDIR mysql-test directory PREFIX/mysql-test5.5.7 
INSTALL_PLUGINDIR Plugin directory PREFIX/lib/plugin5.5.7 
INSTALL_SBINDIR Server executable directory PREFIX/bin5.5.7 
INSTALL_SCRIPTDIR Scripts directory PREFIX/scripts5.5.7 
INSTALL_SHAREDIR aclocal/mysql.m4 installation directory PREFIX/share5.5.7 
INSTALL_SQLBENCHDIR sql-bench directory PREFIX5.5.7 
INSTALL_SUPPORTFILESDIR Extra support files directory PREFIX/support-files5.5.7 
MEMCACHED_HOME Path to memcached [none]5.5.16-ndb-7.2.2 
MYSQL_DATADIR Data directory 5.5.7 
MYSQL_MAINTAINER_MODE Whether to enable MySQL maintainer-specific development environment OFF5.5.7 
MYSQL_PROJECT_NAME Windows/Mac OS X project name 33065.5.21 
MYSQL_TCP_PORT TCP/IP port number 33065.5.7 
MYSQL_UNIX_ADDR Unix socket file /tmp/mysql.sock5.5.7 
ODBC_INCLUDES ODBC includes directory   
ODBC_LIB_DIR ODBC library directory   
SYSCONFDIR Option file directory 5.5.7 
TMPDIR tmpdir default value 5.5.36 
WITH_ASAN Enable AddressSanitizer OFF5.5.35 
WITH_BUNDLED_LIBEVENT Use bundled libevent when building ndbmemcache ON5.5.16-ndb-7.2.2 
WITH_BUNDLED_MEMCACHED Use bundled memcached when building ndbmemcache ON5.5.16-ndb-7.2.2 
WITH_CLASSPATH Classpath to use when building MySQL Cluster Connector for Java. Default is an empty string.   
WITH_DEBUG Whether to include debugging support OFF5.5.7 
WITH_EMBEDDED_SERVER Whether to build embedded server OFF5.5.7 
WITH_EMBEDDED_SHARED_LIBRARY Whether to build a shared embedded server library OFF5.5.37 
WITH_xxx_STORAGE_ENGINE Compile storage engine xxx statically into server 5.5.7 
WITH_ERROR_INSERT Enable error injection in the NDB storage engine. Should not be used for building binaries intended for production. OFF  
WITH_EXTRA_CHARSETS Which extra character sets to include all5.5.7 
WITH_LIBEDIT Use bundled libedit library ON5.5.7 
WITH_LIBWRAP Whether to include libwrap (TCP wrappers) support OFF5.5.7 
WITH_NDB_BINLOG Enable binary logging by default by mysqld. ON  
WITH_NDB_DEBUG Produce a debug build for testing or troubleshooting. OFF  
WITH_NDB_JAVA Enable building of Java and ClusterJ support. Enabled by default. Supported in MySQL Cluster only. ON5.5.27-ndb-7.2.9 
WITH_NDB_PORT Default port used by a management server built with this option. If this option was not used to build it, the management server's default port is 1186. [none]  
WITH_NDB_TEST Include NDB API test programs. OFF  
WITH_NDBMTD Build multi-threaded data node. ON  
WITH_READLINE Use bundled readline library OFF5.5.7 
WITH_SSL Type of SSL support no5.5.7 
WITH_UNIXODBC Enable unixODBC support OFF  
WITH_VALGRIND Whether to compile in Valgrind header files OFF5.5.6 
WITH_ZLIB Type of zlib support system5.5.7 
WITHOUT_xxx_STORAGE_ENGINE Exclude storage engine xxx from build 5.5.7 
WITHOUT_SERVER Do not build the server OFF  

The following sections provide more information about CMake options.

For boolean options, the value may be specified as 1 or ON to enable the option, or as 0 or OFF to disable the option.

Many options configure compile-time defaults that can be overridden at server startup. For example, the CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR options that configure the default installation base directory location, TCP/IP port number, and Unix socket file can be changed at server startup with the --basedir, --port, and --socket options for mysqld. Where applicable, configuration option descriptions indicate the corresponding mysqld startup option.

General Options

Installation Layout Options

The CMAKE_INSTALL_PREFIX option indicates the base installation directory. Other options with names of the form INSTALL_xxx that indicate component locations are interpreted relative to the prefix and their values are relative pathnames. Their values should not include the prefix.

Storage Engine Options

Storage engines are built as plugins. You can build a plugin as a static module (compiled into the server) or a dynamic module (built as a dynamic library that must be installed into the server using the INSTALL PLUGIN statement or the --plugin-load option before it can be used). Some plugins might not support static or dynamic building.

The MyISAM, MERGE, MEMORY, and CSV engines are mandatory (always compiled into the server) and need not be installed explicitly.

To compile a storage engine statically into the server, use -DWITH_engine_STORAGE_ENGINE=1. Some permissible engine values are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, INNOBASE (InnoDB), NDBCLUSTER (NDB), PARTITION (partitioning support), and PERFSCHEMA (Performance Schema). Examples:


WITH_NDBCLUSTER_STORAGE_ENGINE is supported only when building MySQL Cluster using the MySQL Cluster sources. It cannot be used to enable clustering support in other MySQL source trees or distributions. In MySQL Cluster NDB 7.2 source distributions, it is enabled by default. See Section, “Building MySQL Cluster from Source on Linux”, and Section, “Compiling and Installing MySQL Cluster from Source on Windows”, for more information.

To exclude a storage engine from the build, use -DWITHOUT_engine_STORAGE_ENGINE=1. Examples:


If neither -DWITH_engine_STORAGE_ENGINE nor -DWITHOUT_engine_STORAGE_ENGINE are specified for a given storage engine, the engine is built as a shared module, or excluded if it cannot be built as a shared module.

Feature Options

Compiler Flags

To specify your own C and C++ compiler flags, for flags that do not affect optimization, use the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS CMake options.

When providing your own compiler flags, you might want to specify CMAKE_BUILD_TYPE as well.

For example, to create a 32-bit release build on a 64-bit Linux machine, do this:

shell> mkdir bld
shell> cd bld
shell> cmake .. -DCMAKE_C_FLAGS=-m32 \
         -DCMAKE_CXX_FLAGS=-m32 \

If you set flags that affect optimization (-Onumber), you must set the CMAKE_C_FLAGS_build_type and/or CMAKE_CXX_FLAGS_build_type options, where build_type corresponds to the CMAKE_BUILD_TYPE value. To specify a different optimization for the default build type (RelWithDebInfo) set the CMAKE_C_FLAGS_RELWITHDEBINFO and CMAKE_CXX_FLAGS_RELWITHDEBINFO options. For example, to compile on Linux with -O3 and with debug symbols, do this:

shell> cmake .. -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g" \

CMake Options for Compiling MySQL Cluster

The following options are for use when building MySQL Cluster NDB 7.2 or later. These options are supported only with the MySQL Cluster NDB 7.2 and later MySQL Cluster sources; they are not supported when using sources from the MySQL 5.5 Server tree.