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.13 MySQL Source-Configuration Option Reference (CMake)

BUILD_CONFIGUse same build options as official releases 5.5.7
CMAKE_BUILD_TYPEType of build to produceRelWithDebInfo5.5.7
CMAKE_CXX_FLAGSFlags for C++ Compiler  
CMAKE_C_FLAGSFlags for C Compiler  
CMAKE_INSTALL_PREFIXInstallation base directory/usr/local/mysql5.5.8
COMPILATION_COMMENTComment about compilation environment 5.5.7
CPACK_MONOLITHIC_INSTALLWhether package build produces single fileOFF5.5.7
DEFAULT_CHARSETThe default server character setlatin15.5.7
DEFAULT_COLLATIONThe default server collationlatin1_swedish_ci5.5.7
ENABLED_PROFILINGWhether to enable query profiling codeON5.5.7
ENABLE_DEBUG_SYNCWhether to enable Debug Sync supportON5.5.7
ENABLE_DOWNLOADSWhether to download optional filesOFF5.5.7
ENABLE_DTRACEWhether to include DTrace support 5.5.7
ENABLE_GCOVWhether to include gcov support 5.5.14
IGNORE_AIO_CHECKWith -DBUILD_CONFIG=mysql_release, ignore libaio checkOFF5.5.9
INSTALL_BINDIRUser executables directoryPREFIX/bin5.5.7
INSTALL_DOCDIRDocumentation directoryPREFIX/docs5.5.7
INSTALL_INCLUDEDIRHeader file directoryPREFIX/include5.5.7
INSTALL_INFODIRInfo file directoryPREFIX/docs5.5.7
INSTALL_LAYOUTSelect predefined installation layoutSTANDALONE5.5.7
INSTALL_LIBDIRLibrary file directoryPREFIX/lib5.5.7
INSTALL_MANDIRManual page directoryPREFIX/man5.5.7
INSTALL_MYSQLSHAREDIRShared data directoryPREFIX/share5.5.7
INSTALL_MYSQLTESTDIRmysql-test directoryPREFIX/mysql-test5.5.7
INSTALL_PLUGINDIRPlugin directoryPREFIX/lib/plugin5.5.7
INSTALL_SBINDIRServer executable directoryPREFIX/bin5.5.7
INSTALL_SCRIPTDIRScripts directoryPREFIX/scripts5.5.7
INSTALL_SHAREDIRaclocal/mysql.m4 installation directoryPREFIX/share5.5.7
INSTALL_SQLBENCHDIRsql-bench directoryPREFIX5.5.7
INSTALL_SUPPORTFILESDIRExtra support files directoryPREFIX/support-files5.5.7
MEMCACHED_HOMEPath to memcached[none]5.5.16-ndb-7.2.2
MYSQL_DATADIRData directory 5.5.7
MYSQL_MAINTAINER_MODEWhether to enable MySQL maintainer-specific development environmentOFF5.5.7
MYSQL_PROJECT_NAMEWindows/OS X project name33065.5.21
MYSQL_TCP_PORTTCP/IP port number33065.5.7
MYSQL_UNIX_ADDRUnix socket file/tmp/mysql.sock5.5.7
ODBC_INCLUDESODBC includes directory  
ODBC_LIB_DIRODBC library directory  
SYSCONFDIROption file directory 5.5.7
TMPDIRtmpdir default value 5.5.36
WITHOUT_SERVERDo not build the serverOFF 
WITHOUT_xxx_STORAGE_ENGINEExclude storage engine xxx from build 5.5.7
WITH_ASANEnable AddressSanitizerOFF5.5.35
WITH_BUNDLED_LIBEVENTUse bundled libevent when building ndbmemcacheON5.5.16-ndb-7.2.2
WITH_BUNDLED_MEMCACHEDUse bundled memcached when building ndbmemcacheON5.5.16-ndb-7.2.2
WITH_CLASSPATHClasspath to use when building MySQL Cluster Connector for Java. Default is an empty string. 
WITH_DEBUGWhether to include debugging supportOFF5.5.7
WITH_EMBEDDED_SERVERWhether to build embedded serverOFF5.5.7
WITH_EMBEDDED_SHARED_LIBRARYWhether to build a shared embedded server libraryOFF5.5.37
WITH_ERROR_INSERTEnable error injection in the NDB storage engine. Should not be used for building binaries intended for production.OFF 
WITH_EXTRA_CHARSETSWhich extra character sets to includeall5.5.7
WITH_LIBEDITUse bundled libedit libraryON5.5.7
WITH_LIBWRAPWhether to include libwrap (TCP wrappers) supportOFF5.5.7
WITH_NDBMTDBuild multi-threaded data node.ON 
WITH_NDB_BINLOGEnable binary logging by default by mysqld.ON 
WITH_NDB_DEBUGProduce a debug build for testing or troubleshooting.OFF 
WITH_NDB_JAVAEnable building of Java and ClusterJ support. Enabled by default. Supported in MySQL Cluster only.ON5.5.27-ndb-7.2.9
WITH_NDB_PORTDefault 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_TESTInclude NDB API test programs.OFF 
WITH_READLINEUse bundled readline libraryOFF5.5.7
WITH_SSLType of SSL supportbundled5.5.7
WITH_UNIXODBCEnable unixODBC supportOFF 
WITH_VALGRINDWhether to compile in Valgrind header filesOFF5.5.6
WITH_ZLIBType of zlib supportbundled5.5.7
WITH_xxx_STORAGE_ENGINECompile storage engine xxx statically into server 5.5.7

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.