Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 28.7Mb
PDF (A4) - 28.7Mb
Man Pages (TGZ) - 189.2Kb
Man Pages (Zip) - 302.2Kb
Info (Gzip) - 2.8Mb
Info (Zip) - 2.8Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  MySQL Source-Configuration Options

2.9.7 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:

cmake . -LH
ccmake .

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

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.

The following sections provide more information about CMake options.

CMake Option Reference

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)

Formats Description Default Introduced Removed
BUILD_CONFIG Use same build options as official releases
CMAKE_BUILD_TYPE Type of build to produce RelWithDebInfo
CMAKE_CXX_FLAGS Flags for C++ Compiler
CMAKE_C_FLAGS Flags for C Compiler
CMAKE_INSTALL_PREFIX Installation base directory /usr/local/mysql
COMPILATION_COMMENT Comment about compilation environment
CPACK_MONOLITHIC_INSTALL Whether package build produces single file OFF
DEFAULT_CHARSET The default server character set latin1
DEFAULT_COLLATION The default server collation latin1_swedish_ci
ENABLED_PROFILING Whether to enable query profiling code ON
ENABLE_DEBUG_SYNC Whether to enable Debug Sync support ON 5.6.36
ENABLE_DOWNLOADS Whether to download optional files OFF
ENABLE_DTRACE Whether to include DTrace support
ENABLE_GCOV Whether to include gcov support
ENABLE_GPROF Enable gprof (optimized Linux builds only) OFF
IGNORE_AIO_CHECK With -DBUILD_CONFIG=mysql_release, ignore libaio check OFF
INNODB_PAGE_ATOMIC_REF_COUNT Enable or disable atomic page reference counting ON 5.6.16
INSTALL_BINDIR User executables directory PREFIX/bin
INSTALL_DOCDIR Documentation directory PREFIX/docs
INSTALL_INCLUDEDIR Header file directory PREFIX/include
INSTALL_INFODIR Info file directory PREFIX/docs
INSTALL_LAYOUT Select predefined installation layout STANDALONE
INSTALL_LIBDIR Library file directory PREFIX/lib
INSTALL_MANDIR Manual page directory PREFIX/man
INSTALL_MYSQLSHAREDIR Shared data directory PREFIX/share
INSTALL_MYSQLTESTDIR mysql-test directory PREFIX/mysql-test
INSTALL_PLUGINDIR Plugin directory PREFIX/lib/plugin
INSTALL_SBINDIR Server executable directory PREFIX/bin
INSTALL_SCRIPTDIR Scripts directory PREFIX/scripts
INSTALL_SECURE_FILE_PRIVDIR secure_file_priv default value platform specific 5.6.34
INSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR secure_file_priv default value for libmysqld 5.6.34
INSTALL_SHAREDIR aclocal/mysql.m4 installation directory PREFIX/share
INSTALL_SUPPORTFILESDIR Extra support files directory PREFIX/support-files
MEMCACHED_HOME Path to memcached; obsolete [none] 5.6.51
MYSQL_DATADIR Data directory
MYSQL_MAINTAINER_MODE Whether to enable MySQL maintainer-specific development environment OFF
MYSQL_PROJECT_NAME Windows/macOS project name MySQL
MYSQL_TCP_PORT TCP/IP port number 3306
MYSQL_UNIX_ADDR Unix socket file /tmp/mysql.sock
ODBC_INCLUDES ODBC includes directory
ODBC_LIB_DIR ODBC library directory
OPTIMIZER_TRACE Whether to support optimizer tracing
REPRODUCIBLE_BUILD Take extra care to create a build result independent of build location and time 5.6.37
SUNPRO_CXX_LIBRARY Client link library on Solaris 10+ 5.6.20
SYSCONFDIR Option file directory
TMPDIR tmpdir default value 5.6.16
WITHOUT_SERVER Do not build the server OFF
WITHOUT_xxx_STORAGE_ENGINE Exclude storage engine xxx from build
WITH_ASAN Enable AddressSanitizer OFF 5.6.15
WITH_BUNDLED_LIBEVENT Use bundled libevent when building ndbmemcache; obsolete ON 5.6.51
WITH_BUNDLED_MEMCACHED Use bundled memcached when building ndbmemcache; obsolete ON 5.6.51
WITH_CLASSPATH Classpath to use when building MySQL Cluster Connector for Java. Default is an empty string.
WITH_DEBUG Whether to include debugging support OFF
WITH_DEFAULT_COMPILER_OPTIONS Whether to use default compiler options ON
WITH_DEFAULT_FEATURE_SET Whether to use default feature set ON
WITH_EDITLINE Which libedit/editline library to use bundled 5.6.12
WITH_EMBEDDED_SERVER Whether to build embedded server OFF
WITH_EMBEDDED_SHARED_LIBRARY Whether to build a shared embedded server library OFF 5.6.17
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 all
WITH_GMOCK Path to googlemock distribution
WITH_INNODB_MEMCACHED Whether to generate memcached shared libraries. OFF
WITH_LIBEDIT Use bundled libedit library ON 5.6.12
WITH_LIBEVENT Which libevent library to use bundled
WITH_LIBWRAP Whether to include libwrap (TCP wrappers) support OFF
WITH_NDBAPI_EXAMPLES Build API example programs OFF
WITH_NDBCLUSTER Build the NDB storage engine ON
WITH_NDBCLUSTER_STORAGE_ENGINE For internal use; may not work as expected in all circumstances; users should employ WITH_NDBCLUSTER instead ON
WITH_NDBMTD Build multithreaded data node. ON
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. ON
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_NUMA Set NUMA memory allocation policy 5.6.27
WITH_SSL Type of SSL support system
WITH_SYMVER16 Whether contains both symver 16 and 18 symbols. OFF 5.6.31
WITH_UNIT_TESTS Compile MySQL with unit tests ON
WITH_UNIXODBC Enable unixODBC support OFF
WITH_VALGRIND Whether to compile in Valgrind header files OFF
WITH_ZLIB Type of zlib support bundled
WITH_xxx_STORAGE_ENGINE Compile storage engine xxx statically into server

General Options

  • -DBUILD_CONFIG=mysql_release

    This option configures a source distribution with the same build options used by Oracle to produce binary distributions for official MySQL releases.


    The type of build to produce:

    • RelWithDebInfo: Enable optimizations and generate debugging information. This is the default MySQL build type.

    • Debug: Disable optimizations and generate debugging information. This build type is also used if the WITH_DEBUG option is enabled. That is, -DWITH_DEBUG=1 has the same effect as -DCMAKE_BUILD_TYPE=Debug.


    This option affects whether the make package operation produces multiple installation package files or a single file. If disabled, the operation produces multiple installation package files, which may be useful if you want to install only a subset of a full MySQL installation. If enabled, it produces a single file for installing everything.

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 InnoDB, 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, PARTITION (partitioning support), and PERFSCHEMA (Performance Schema). Examples:


To build MySQL with support for NDB Cluster, use the WITH_NDBCLUSTER option.


WITH_NDBCLUSTER is supported only when building NDB Cluster using the NDB Cluster sources. It cannot be used to enable clustering support in other MySQL source trees or distributions. In NDB Cluster source distributions, it is enabled by default. See Section, “Building NDB Cluster from Source on Linux”, and Section, “Compiling and Installing NDB 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


    A descriptive comment about the compilation environment.

  • -DDEFAULT_CHARSET=charset_name

    The server character set. By default, MySQL uses the latin1 (cp1252 West European) character set.

    charset_name 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, utf8mb4, utf16, utf16le, utf32. The permissible character sets are listed in the cmake/character_sets.cmake file as the value of CHARSETS_AVAILABLE.

    This value can be set at server startup with the --character_set_server option.

  • -DDEFAULT_COLLATION=collation_name

    The server collation. By default, MySQL uses latin1_swedish_ci. Use the SHOW COLLATION statement to determine which collations are available for each character set.

    This value can be set at server startup with the --collation_server option.



    As of MySQL 5.6.36, ENABLE_DEBUG_SYNC is removed and enabling WITH_DEBUG enables Debug Sync.

    Whether to compile the Debug Sync facility into the server. This facility is used for testing and debugging. This option is enabled by default, but has no effect unless MySQL is configured with debugging enabled. If debugging is enabled and you want to disable Debug Sync, use -DENABLE_DEBUG_SYNC=0.

    When compiled in, Debug Sync is disabled by default at runtime. To enable it, start mysqld with the --debug-sync-timeout=N option, where N is a timeout value greater than 0. (The default value is 0, which disables Debug Sync.) N becomes the default timeout for individual synchronization points.

    For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.


    Whether to download optional files. For example, with this option enabled, CMake downloads the Google Test distribution that is used by the test suite to run unit tests.


    Whether to include support for DTrace probes. For information about DTrace, wee Section 5.8.4, “Tracing mysqld Using DTrace”


    Whether to build without MySQL Server. The default is OFF, which does build the server.

    This is considered an experimental option; it's preferred to build with the server.

  • -DENABLE_GCOV=bool

    Whether to include gcov support (Linux only).


    Whether to enable gprof (optimized Linux builds only).


    This option controls the compiled-in default LOCAL capability for the MySQL client library. Clients that make no explicit arrangements therefore have LOCAL capability disabled or enabled according to the ENABLED_LOCAL_INFILE setting specified at MySQL build time.

    By default, the client library in MySQL binary distributions is compiled with ENABLED_LOCAL_INFILE enabled. If you compile MySQL from source, configure it with ENABLED_LOCAL_INFILE disabled or enabled based on whether clients that make no explicit arrangements should have LOCAL capability disabled or enabled, respectively.

    ENABLED_LOCAL_INFILE controls the default for client-side LOCAL capability. For the server, the local_infile system variable controls server-side LOCAL capability. To explicitly cause the server to refuse or permit LOAD DATA LOCAL statements (regardless of how client programs and libraries are configured at build time or runtime), start mysqld with local_infile disabled or enabled, respectively. local_infile can also be set at runtime. See Section 6.1.6, “Security Considerations for LOAD DATA LOCAL”.


    Whether to enable query profiling code (for the SHOW PROFILE and SHOW PROFILES statements).


    If the -DBUILD_CONFIG=mysql_release option is given on Linux, the libaio library must be linked in by default. If you do not have libaio or do not want to install it, you can suppress the check for it by specifying -DIGNORE_AIO_CHECK=1.


    Whether to enable or disable atomic page reference counting. Fetching and releasing pages from the buffer pool and tracking the page state are expensive and complex operations. Using a page mutex to track these operations does not scale well. With INNODB_PAGE_ATOMIC_REF_COUNT=ON (default), fetch and release is tracked using atomics where available. For platforms that do not support atomics, set INNODB_PAGE_ATOMIC_REF_COUNT=OFF to disable atomic page reference counting.

    When atomic page reference counting is enabled (default), [Note] InnoDB: Using atomics to ref count buffer pool pages is printed to the error log at server startup. If atomic page reference counting is disabled, [Note] InnoDB: Using mutexes to ref count buffer pool pages is printed instead.

    INNODB_PAGE_ATOMIC_REF_COUNT was introduced with the fix for MySQL Bug #68079. The option is removed in MySQL 5.7.5. Support for atomics is required to build MySQL as of MySQL 5.7.5, which makes the option obsolete.


    Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors. It may also cause some minor changes in generated code, to initialize some variables to 0.


    For Windows or macOS, the project name to incorporate into the project file name.

  • -DMYSQL_TCP_PORT=port_num

    The port number on which the server listens for TCP/IP connections. The default is 3306.

    This value can be set at server startup with the --port option.

  • -DMYSQL_UNIX_ADDR=file_name

    The Unix socket file path on which the server listens for socket connections. This must be an absolute path name. The default is /tmp/mysql.sock.

    This value can be set at server startup with the --socket option.


    Whether to support optimizer tracing. See MySQL Internals: Tracing the Optimizer.


    For builds on Linux systems, this option controls whether to take extra care to create a build result independent of build location and time.

    This option was added in MySQL 5.6.37.

  • -DWITH_ASAN=bool

    Whether to enable AddressSanitizer, for compilers that support it. The default is off. This option was added in MySQL 5.6.15.

  • -DWITH_DEBUG=bool

    Whether to include debugging support.

    Configuring 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.

    As of MySQL 5.6.36, enabling WITH_DEBUG also enables Debug Sync. For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.


    Whether to use the flags from cmake/build_configurations/feature_set.cmake.


    Which libedit/editline library to use. The permitted values are bundled (the default) and system.

    WITH_EDITLINE was added in MySQL 5.6.12. It replaces WITH_LIBEDIT, which has been removed.


    Whether to build the libmysqld embedded server library.


    Whether to build a shared libmysqld embedded server library. This option was added in MySQL 5.6.17.


    Which extra character sets to include:

    • all: All character sets. This is the default.

    • complex: Complex character sets.

    • none: No extra character sets.

  • -DWITH_GMOCK=path_name

    The path to the googlemock distribution, for use with Google Test-based unit tests. The option value is the path to the distribution Zip file. Alternatively, set the WITH_GMOCK environment variable to the path name. It is also possible to use -DENABLE_DOWNLOADS=1 so that CMake downloads the distribution from GitHub.

    If you build MySQL without the Google Test-based unit tests (by configuring wihout WITH_GMOCK), CMake displays a message indicating how to download it.


    Whether to generate memcached shared libraries ( and

  • -DWITH_LIBEVENT=string

    Which libevent library to use. Permitted values are bundled (default), system, and yes. If you specify system or yes, the system libevent library is used if present. If the system library is not found, the bundled libevent library is used. The libevent library is required by InnoDB memcached.


    Whether to use the libedit library bundled with the distribution.

    WITH_LIBEDIT was removed in MySQL 5.6.12. Use WITH_EDITLINE instead.


    Whether to include libwrap (TCP wrappers) support.

  • -DWITH_NUMA=bool

    Explicitly set the NUMA memory allocation policy. CMake sets the default WITH_NUMA value based on whether the current platform has NUMA support. For platforms without NUMA support, CMake behaves as follows:

    • With no NUMA option (the normal case), CMake continues normally, producing only this warning: NUMA library missing or required version not available

    • With -DWITH_NUMA=ON, CMake aborts with this error: NUMA library missing or required version not available

    This option was added in MySQL 5.6.27.

  • -DWITH_SSL={ssl_type|path_name}

    For support of encrypted connections, entropy for random number generation, and other encryption-related operations, MySQL must be built using an SSL library. This option specifies which SSL library to use.

    • ssl_type can be one of the following values:

      • no: No SSL support. This is the default before MySQL 5.6.6. As of 5.6.6, this is no longer a permitted value and the default is bundled.

      • yes: Use the system OpenSSL library if present, else the library bundled with the distribution.

      • bundled: Use the SSL library bundled with the distribution. This is the default from MySQL 5.6.6 through 5.6.45. As of 5.6.46, this is no longer a permitted value and the default is system.

      • system: Use the system OpenSSL library. This is the default as of MySQL 5.6.46.

    • path_name, permitted for MySQL 5.6.7 and after, is the path name to the OpenSSL installation to use. This can be preferable to using the ssl_type value of system because it can prevent CMake from detecting and using an older or incorrect OpenSSL version installed on the system. (Another permitted way to do the same thing is to set WITH_SSL to system and set the CMAKE_PREFIX_PATH option to path_name.)

    For additional information about configuring the SSL library, see Section 2.9.6, “Configuring SSL Library Support”.

  • -DWITH_SYMVER16=bool

    If enabled, this option causes the libmysqlclient client library to contain extra symbols to be compatible with libmysqlclient on RHEL/OEL 5, 6, and 7; and Fedora releases. All symbols present in are tagged with symver 16 in, making those symbols have both symver 16 and 18. The default is OFF.

    This option was added in MySQL 5.6.31.


    If enabled, compile MySQL with unit tests. The default is ON unless the server is not being compiled.


    Enables unixODBC support, for Connector/ODBC.


    Whether to compile in the Valgrind header files, which exposes the Valgrind API to MySQL code. The default is OFF.

    To generate a Valgrind-aware debug build, -DWITH_VALGRIND=1 normally is combined with -DWITH_DEBUG=1. See Building Debug Configurations.

  • -DWITH_ZLIB=zlib_type

    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 option indicates the source of zlib support:

    • bundled: Use the zlib library bundled with the distribution. This is the default.

    • system: Use the system zlib library.

Compiler Flags

  • -DCMAKE_C_FLAGS="flags"

    Flags for the C Compiler.

  • -DCMAKE_CXX_FLAGS="flags"

    Flags for the C++ Compiler.


    Whether to use the flags from cmake/build_configurations/compiler_options.cmake.


    All optimization flags were carefully chosen and tested by the MySQL build team. Overriding them can lead to unexpected results and is done at your own risk.

  • -DSUNPRO_CXX_LIBRARY="lib_name"

    Enable linking against libCstd instead of stlport4 on Solaris 10 or later. This works only for client code because the server depends on C++98.

    This option was added in MySQL 5.6.20.

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:

mkdir bld
cd bld
cmake .. -DCMAKE_C_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:


CMake Options for Compiling NDB Cluster

The following options are for use when building NDB Cluster with the NDB Cluster sources; they are not currently supported when using sources from the MySQL 5.6 Server tree.

  • -DMEMCACHED_HOME=dir_name

    NDB support for memcached was removed in NDB 7.3.32 and NDB 7.4.31, and thus this option is no longer supported for building NDB in these or later versions.


    NDB support for memcached was removed in NDB 7.3.32 and NDB 7.4.31, and thus this option is no longer supported for building NDB in these or later versions.


    NDB support for memcached was removed in NDB 7.3.32 and NDB 7.4.31, and thus this option is no longer supported for building NDB in these or later versions.


    Sets the classpath for building NDB Cluster Connector for Java. The default is empty. In MySQL NDB Cluster 7.2.9 and later, this option is ignored if -DWITH_NDB_JAVA=OFF is used.


    Enables error injection in the NDB kernel. For testing only; not intended for use in building production binaries. The default is OFF.


    Build API example programs in storage/ndb/ndbapi-examples/.


    For internal use only; may not always work as expected. To build with NDB support, use WITH_NDBCLUSTER instead.


    Build and link in support for the NDB storage engine in mysqld. The default is ON.


    Build the multithreaded data node executable ndbmtd. The default is ON.


    Enable binary logging by default in the mysqld built using this option. ON by default.


    Enable building the debug versions of the NDB Cluster binaries. OFF by default.


    Enable building NDB Cluster with Java support, including ClusterJ.

    This option was added in MySQL NDB Cluster 7.2.9, and is ON by default. If you do not wish to compile NDB Cluster with Java support, you must disable it explicitly by specifying -DWITH_NDB_JAVA=OFF when running CMake. Otherwise, if Java cannot be found, configuration of the build fails.

  • -DWITH_NDB_PORT=port

    Causes the NDB Cluster management server (ndb_mgmd) that is built to use this port by default. If this option is unset, the resulting management server tries to use port 1186 by default.


    If enabled, include a set of NDB API test programs. The default is OFF.