Building MySQL from Source  /  MySQL Source-Configuration Options

Chapter 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 MySQL Program 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 4.1 MySQL Source-Configuration Option Reference (CMake)

FormatsDescriptionDefaultIntroducedRemoved
BUILD_CONFIGUse same build options as official releases   
CMAKE_BUILD_TYPEType of build to produceRelWithDebInfo  
CMAKE_CXX_FLAGSFlags for C++ Compiler   
CMAKE_C_FLAGSFlags for C Compiler   
CMAKE_INSTALL_PREFIXInstallation base directory/usr/local/mysql  
COMPILATION_COMMENTComment about compilation environment   
CPACK_MONOLITHIC_INSTALLWhether package build produces single fileOFF  
DEFAULT_CHARSETThe default server character setlatin1  
DEFAULT_COLLATIONThe default server collationlatin1_swedish_ci  
DISABLE_PSI_CONDExclude Performance Schema condition instrumentationOFF5.7.3 
DISABLE_PSI_FILEExclude Performance Schema file instrumentationOFF5.7.3 
DISABLE_PSI_IDLEExclude Performance Schema idle instrumentationOFF5.7.3 
DISABLE_PSI_MEMORYExclude Performance Schema memory instrumentationOFF5.7.3 
DISABLE_PSI_METADATAExclude Performance Schema metadata instrumentationOFF5.7.3 
DISABLE_PSI_MUTEXExclude Performance Schema mutex instrumentationOFF5.7.3 
DISABLE_PSI_RWLOCKExclude Performance Schema rwlock instrumentationOFF5.7.3 
DISABLE_PSI_SOCKETExclude Performance Schema socket instrumentationOFF5.7.3 
DISABLE_PSI_SPExclude Performance Schema stored program instrumentationOFF5.7.3 
DISABLE_PSI_STAGEExclude Performance Schema stage instrumentationOFF5.7.3 
DISABLE_PSI_STATEMENTExclude Performance Schema statement instrumentationOFF5.7.3 
DISABLE_PSI_STATEMENT_DIGESTExclude Performance Schema statement_digest instrumentationOFF5.7.3 
DISABLE_PSI_TABLEExclude Performance Schema table instrumentationOFF5.7.3 
DOWNLOAD_BOOSTWhether to download the Boost libraryOFF5.7.5 
DOWNLOAD_BOOST_TIMEOUTTimeout in seconds for downloading the Boost library6005.7.6 
-DWITH_PROTOBUFWhich Protocol Buffers package to usebundled5.7.12 
ENABLED_LOCAL_INFILEWhether to enable LOCAL for LOAD DATA INFILEOFF  
ENABLED_PROFILINGWhether to enable query profiling codeON  
ENABLE_DEBUG_SYNCWhether to enable Debug Sync supportON  
ENABLE_DOWNLOADSWhether to download optional filesOFF  
ENABLE_DTRACEWhether to include DTrace support   
ENABLE_GCOVWhether to include gcov support   
ENABLE_GPROFEnable gprof (optimized Linux builds only)OFF  
FORCE_UNSUPPORTED_COMPILERWhether to permit unsupported compilerOFF5.7.5 
IGNORE_AIO_CHECKWith -DBUILD_CONFIG=mysql_release, ignore libaio checkOFF  
INNODB_PAGE_ATOMIC_REF_COUNTEnable or disable atomic page reference countingON5.7.45.7.5
INSTALL_BINDIRUser executables directoryPREFIX/bin  
INSTALL_DOCDIRDocumentation directoryPREFIX/docs  
INSTALL_DOCREADMEDIRREADME file directoryPREFIX  
INSTALL_INCLUDEDIRHeader file directoryPREFIX/include  
INSTALL_INFODIRInfo file directoryPREFIX/docs  
INSTALL_LAYOUTSelect predefined installation layoutSTANDALONE  
INSTALL_LIBDIRLibrary file directoryPREFIX/lib  
INSTALL_MANDIRManual page directoryPREFIX/man  
INSTALL_MYSQLKEYRINGDIRDirectory for keyring_file plugin data fileplatform specific5.7.11 
INSTALL_MYSQLSHAREDIRShared data directoryPREFIX/share  
INSTALL_MYSQLTESTDIRmysql-test directoryPREFIX/mysql-test  
INSTALL_PKGCONFIGDIRDirectory for mysqlclient.pc pkg-config fileINSTALL_LIBDIR/pkgconfig5.7.9 
INSTALL_PLUGINDIRPlugin directoryPREFIX/lib/plugin  
INSTALL_SBINDIRServer executable directoryPREFIX/bin  
INSTALL_SCRIPTDIRScripts directoryPREFIX/scripts  
INSTALL_SECURE_FILE_PRIVDIRsecure_file_priv default valueplatform specific5.7.6 
INSTALL_SECURE_FILE_PRIV_EMBEDDEDDIRsecure_file_priv default value for libmysqld 5.7.8 
INSTALL_SHAREDIRaclocal/mysql.m4 installation directoryPREFIX/share  
INSTALL_SQLBENCHDIRsql-bench directoryPREFIX 5.7.8
INSTALL_SUPPORTFILESDIRExtra support files directoryPREFIX/support-files  
MAX_INDEXESMaximum indexes per table645.7.1 
MUTEX_TYPEInnoDB mutex typeevent5.7.2 
MYSQL_DATADIRData directory   
MYSQL_MAINTAINER_MODEWhether to enable MySQL maintainer-specific development environmentOFF  
MYSQL_PROJECT_NAMEWindows/OS X project name3306  
MYSQL_TCP_PORTTCP/IP port number3306  
MYSQL_UNIX_ADDRUnix socket file/tmp/mysql.sock  
ODBC_INCLUDESODBC includes directory   
ODBC_LIB_DIRODBC library directory   
OPTIMIZER_TRACEWhether to support optimizer tracing   
SUNPRO_CXX_LIBRARYClient link library on Solaris 10+ 5.7.5 
SYSCONFDIROption file directory   
SYSTEMD_PID_DIRDirectory for PID file under systemd/var/run/mysqld5.7.6 
SYSTEMD_SERVICE_NAMEName of MySQL service under systemdmysqld5.7.6 
TMPDIRtmpdir default value 5.7.4 
WIN_DEBUG_NO_INLINEWhether to disable function inliningOFF5.7.6 
WITHOUT_SERVERDo not build the serverOFF  
WITHOUT_xxx_STORAGE_ENGINEExclude storage engine xxx from build   
WITH_ASANEnable AddressSanitizerOFF5.7.3 
WITH_AUTHENTICATION_PAMBuild PAM authentication pluginOFF  
WITH_BOOSTThe location of the Boost library sources 5.7.5 
WITH_CLIENT_PROTOCOL_TRACINGBuild client-side protocol tracing frameworkON5.7.2 
WITH_DEBUGWhether to include debugging supportOFF  
WITH_DEFAULT_COMPILER_OPTIONSWhether to use default compiler optionsON  
WITH_DEFAULT_FEATURE_SETWhether to use default feature setON  
WITH_EDITLINEWhich libedit/editline library to usebundled5.7.2 
WITH_EMBEDDED_SERVERWhether to build embedded serverOFF  
WITH_EMBEDDED_SHARED_LIBRARYWhether to build a shared embedded server libraryOFF5.7.4 
WITH_EXTRA_CHARSETSWhich extra character sets to includeall  
WITH_INNODB_EXTRA_DEBUGWhether to include extra debugging support for InnoDB.OFF5.7.2 
WITH_INNODB_MEMCACHEDWhether to generate memcached shared libraries.OFF  
WITH_KEYRING_TESTBuild the keyring test programOFF5.7.11 
WITH_LIBEVENTWhich libevent library to usebundled  
WITH_LIBWRAPWhether to include libwrap (TCP wrappers) supportOFF  
WITH_LZ4Type of LZ4 supportbundled5.7.14 
WITH_MECABCompiles MeCab 5.7.6 
WITH_MSANEnable MemorySanitizerOFF5.7.4 
WITH_MSCRT_DEBUGEnable Visual Studio CRT memory leak tracingOFF5.7.6 
WITH_NDBCLUSTERBuild the NDB storage engine; alias for WITH_NDBCLUSTER_STORAGE_ENGINEON  
WITH_NDBCLUSTER_STORAGE_ENGINEBuild the NDB storage engineON  
WITH_NUMASet NUMA memory allocation policy 5.7.17 
WITH_RAPIDWhether to build rapid development cycle pluginsON5.7.12 
WITH_SSLType of SSL supportbundled  
WITH_SYSTEMDEnable installation of systemd support filesOFF5.7.6 
WITH_TEST_TRACE_PLUGINBuild test protocol trace pluginOFF5.7.2 
WITH_UBSANEnable Undefined Behavior SanitizerOFF5.7.6 
WITH_UNIXODBCEnable unixODBC supportOFF  
WITH_VALGRINDWhether to compile in Valgrind header filesOFF  
WITH_ZLIBType of zlib supportbundled  
WITH_xxx_STORAGE_ENGINECompile storage engine xxx statically into server   

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

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

  • -DCMAKE_BUILD_TYPE=type

    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.

  • -DCPACK_MONOLITHIC_INSTALL=bool

    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.

  • -DCMAKE_INSTALL_PREFIX=dir_name

    The installation base directory.

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

  • -DINSTALL_BINDIR=dir_name

    Where to install user programs.

  • -DINSTALL_DOCDIR=dir_name

    Where to install documentation.

  • -DINSTALL_DOCREADMEDIR=dir_name

    Where to install README files.

  • -DINSTALL_INCLUDEDIR=dir_name

    Where to install header files.

  • -DINSTALL_INFODIR=dir_name

    Where to install Info files.

  • -DINSTALL_LAYOUT=name

    Select a predefined installation layout:

    • STANDALONE: Same layout as used for .tar.gz and .zip packages. This is the default.

    • RPM: Layout similar to RPM packages.

    • SVR4: Solaris package layout.

    • DEB: DEB package layout (experimental).

    You can select a predefined layout but modify individual component installation locations by specifying other options. For example:

    shell> cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data
    

    As of MySQL 5.7.6, the INSTALL_LAYOUT value determines the default value of the secure_file_priv system and keyring_file_data system variables; see the descriptions of those variables in Server System Variables.

  • -DINSTALL_LIBDIR=dir_name

    Where to install library files.

  • -DINSTALL_MANDIR=dir_name

    Where to install manual pages.

  • -DINSTALL_MYSQLKEYRINGDIR=dir_path

    The default directory to use as the location of the keyring_file plugin data file. The default value is platform specific and depends on the value of the INSTALL_LAYOUT CMake option; see the description of the keyring_file_data system variable in Server System Variables.

    This option was added in MySQL 5.7.11.

  • -DINSTALL_MYSQLSHAREDIR=dir_name

    Where to install shared data files.

  • -DINSTALL_MYSQLTESTDIR=dir_name

    Where to install the mysql-test directory. As of MySQL 5.7.2, to suppress installation of this directory, explicitly set the option to the empty value (-DINSTALL_MYSQLTESTDIR=).

  • -DINSTALL_PKGCONFIGDIR=dir_name

    The directory in which to install the mysqlclient.pc file for use by pkg-config. The default value is INSTALL_LIBDIR/pkgconfig, unless INSTALL_LIBDIR ends with /mysql, in which case that is removed first.

    This option was added in MySQL 5.7.9.

  • -DINSTALL_PLUGINDIR=dir_name

    The location of the plugin directory.

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

  • -DINSTALL_SBINDIR=dir_name

    Where to install the mysqld server.

  • -DINSTALL_SCRIPTDIR=dir_name

    Where to install mysql_install_db.

  • -DINSTALL_SECURE_FILE_PRIVDIR=dir_name

    The default value for the secure_file_priv system variable. The default value is platform specific and depends on the value of the INSTALL_LAYOUT CMake option; see the description of the secure_file_priv system variable in Server System Variables.

    This option was added in MySQL 5.7.6. To set the value for the libmysqld embedded server, use INSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR.

  • -DINSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR=dir_name

    The default value for the secure_file_priv system variable, for the libmysqld embedded server. This option was added in MySQL 5.7.8.

  • -DINSTALL_SHAREDIR=dir_name

    Where to install aclocal/mysql.m4.

  • -DINSTALL_SQLBENCHDIR=dir_name

    Where to install the sql-bench directory. To suppress installation of this directory, explicitly set the option to the empty value (-DINSTALL_SQLBENCHDIR=).

    As of MySQL 5.7.8, the sql-bench directory is no longer included in MYSQL distributions, so the INSTALL_SQLBENCHDIR= option is removed as well.

  • -DINSTALL_SUPPORTFILESDIR=dir_name

    Where to install extra support files.

  • -DMYSQL_DATADIR=dir_name

    The location of the MySQL data directory.

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

  • -DODBC_INCLUDES=dir_name

    The location of the ODBC includes directory, and may be used while configuring Connector/ODBC.

  • -DODBC_LIB_DIR=dir_name

    The location of the ODBC library directory, and may be used while configuring Connector/ODBC.

  • -DSYSCONFDIR=dir_name

    The default my.cnf option file directory.

    This location cannot be set at server startup, but you can start the server with a given option file using the --defaults-file=file_name option, where file_name is the full path name to the file.

  • -DSYSTEMD_PID_DIR=dir_name

    The name of the directory in which to create the PID file when MySQL is managed by systemd. The default is /var/run/mysqld; this might be changed implicitly according to the INSTALL_LAYOUT value.

    This option is ignored unless WITH_SYSTEMD is enabled. It was added in MySQL 5.7.6.

  • -DSYSTEMD_SERVICE_NAME=name

    The name of the MySQL service to use when MySQL is managed by systemd. The default is mysqld; this might be changed implicitly according to the INSTALL_LAYOUT value.

    This option is ignored unless WITH_SYSTEMD is enabled. It was added in MySQL 5.7.6.

  • -DTMPDIR=dir_name

    The default location to use for the tmpdir system variable. If unspecified, the value defaults to P_tmpdir in <stdio.h>. This option was added in MySQL 5.7.4.

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

-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1
Note

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 source distributions, it is enabled by default. See Building NDB Cluster from Source on Linux, and Compiling and Installing NDB Cluster from Source on Windows, for more information.

Note

As of MySQL 5.7.9, it is not possible to compile without Performance Schema support. If it is desired to compile without particular types of instrumentation, that can be done with the following CMake options:

DISABLE_PSI_COND
DISABLE_PSI_FILE
DISABLE_PSI_IDLE
DISABLE_PSI_MEMORY
DISABLE_PSI_METADATA
DISABLE_PSI_MUTEX
DISABLE_PSI_PS
DISABLE_PSI_RWLOCK
DISABLE_PSI_SOCKET
DISABLE_PSI_SP
DISABLE_PSI_STAGE
DISABLE_PSI_STATEMENT
DISABLE_PSI_STATEMENT_DIGEST
DISABLE_PSI_TABLE
DISABLE_PSI_THREAD
DISABLE_PSI_TRANSACTION

For example, to compile without mutex instrumentation, configure MySQL using the -DDISABLE_PSI_MUTEX=1 option.

As of MySQL 5.7.4, to exclude a storage engine from the build, use -DWITH_engine_STORAGE_ENGINE=0. Examples:

-DWITH_EXAMPLE_STORAGE_ENGINE=0
-DWITH_FEDERATED_STORAGE_ENGINE=0
-DWITH_PARTITION_STORAGE_ENGINE=0

Before MySQL 5.7.4, to exclude a storage engine from the build, use -DWITHOUT_engine_STORAGE_ENGINE=1. (That syntax also works in 5.7.4 or later, but -DWITH_engine_STORAGE_ENGINE=0 is preferred.) Examples:

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-DWITHOUT_PARTITION_STORAGE_ENGINE=1

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

  • -DCOMPILATION_COMMENT=string

    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.

  • -DDISABLE_PSI_COND=bool

    Whether to exclude the Performance Schema condition instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_FILE=bool

    Whether to exclude the Performance Schema file instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_IDLE=bool

    Whether to exclude the Performance Schema idle instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_MEMORY=bool

    Whether to exclude the Performance Schema memory instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_METADATA=bool

    Whether to exclude the Performance Schema metadata instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_MUTEX=bool

    Whether to exclude the Performance Schema mutex instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_RWLOCK=bool

    Whether to exclude the Performance Schema rwlock instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_SOCKET=bool

    Whether to exclude the Performance Schema socket instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_SP=bool

    Whether to exclude the Performance Schema stored program instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_STAGE=bool

    Whether to exclude the Performance Schema stage instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_STATEMENT=bool

    Whether to exclude the Performance Schema statement instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_STATEMENT_DIGEST=bool

    Whether to exclude the Performance Schema statement_digest instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDISABLE_PSI_TABLE=bool

    Whether to exclude the Performance Schema table instrumentation. The default is OFF (include). This option was added in MySQL 5.7.3.

  • -DDOWNLOAD_BOOST=bool

    Whether to download the Boost library. The default is OFF. This option was added in MySQL 5.7.5.

    See the WITH_BOOST option for additional discussion about using Boost.

  • -DDOWNLOAD_BOOST_TIMEOUT=seconds

    The timeout in seconds for downloading the Boost library. The default is 600 seconds. This option was added in MySQL 5.7.6.

    See the WITH_BOOST option for additional discussion about using Boost.

  • -DENABLE_DEBUG_SYNC=bool

    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.

    As of MySQL 5.7.8, sync debug checking for the InnoDB storage engine is available when debugging support is compiled in using the WITH_DEBUG option.

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

  • -DENABLE_DOWNLOADS=bool

    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.

  • -DENABLE_DTRACE=bool

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

    This option is deprecated because support for DTrace is deprecated in MySQL 5.7 and is removed in MySQL 8.0.

  • -DENABLE_GCOV=bool

    Whether to include gcov support (Linux only).

  • -DENABLE_GPROF=bool

    Whether to enable gprof (optimized Linux builds only).

  • -DENABLED_LOCAL_INFILE=bool

    Whether to enable LOCAL capability in the client library for LOAD DATA INFILE.

    This option controls client-side LOCAL capability, but the capability can be set on the server side at server startup with the --local-infile option. See Security Issues with LOAD DATA LOCAL.

  • -DENABLED_PROFILING=bool

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

  • -DFORCE_UNSUPPORTED_COMPILER=bool

    By default, CMake checks for minimum versions of supported compilers: gcc 4.4 (Linux, Solaris); Sun Studio 12u2 (Solaris client library); Clang 3.3 (OS X, FreeBSD). To disable this check, use -DFORCE_UNSUPPORTED_COMPILER=ON. This option was added in MySQL 5.7.5.

  • -DIGNORE_AIO_CHECK=bool

    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.

  • -DINNODB_PAGE_ATOMIC_REF_COUNT=bool

    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.

  • -DMAX_INDEXES=num

    The maximum number of indexes per table. The default is 64. The maximum is 255. Values smaller than 64 are ignored and the default of 64 is used.

  • -DMYSQL_MAINTAINER_MODE=bool

    Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors.

  • -DMUTEX_TYPE=type

    The mutex type used by InnoDB. Options include:

    • event: Use event mutexes. This is the default value and the original InnoDB mutex implementation.

    • sys: Use POSIX mutexes on UNIX systems. Use CRITICAL_SECTION onjects on Windows, if available.

    • futex: Use Linux futexes instead of condition variables to schedule waiting threads.

  • -DMYSQL_PROJECT_NAME=name

    For Windows or OS X, 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.

  • -DOPTIMIZER_TRACE=bool

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

  • -DWIN_DEBUG_NO_INLINE=bool

    Whether to disable function inlining on Windows. The default is off (inlining enabled). This option was added in MySQL 5.7.6.

  • -DWITH_ASAN=bool

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

  • -DWITH_AUTHENTICATION_PAM=bool

    Whether to build the PAM authentication plugin, for source trees that include this plugin. (See The PAM Authentication Plugin.) Beginning with MySQL 5.7.2, if this option is specified and the plugin cannot be compiled, the build fails.

  • -DWITH_BOOST=path_name

    As of MySQL 5.7.5, the Boost library is required to build MySQL. These CMake options enable control over the library source location, and whether to download it automatically:

    • -DWITH_BOOST=path_name specifies the Boost library directory location. It is also possible to specify the Boost location by setting the BOOST_ROOT or WITH_BOOST environment variable.

      As of MySQL 5.7.11, -DWITH_BOOST=system is permitted and indicates that the correct version of Boost is installed on the compilation host in the standard location. In this case, the installed version of Boost is used rather than any version included with a MySQL source distribution.

    • -DDOWNLOAD_BOOST=bool specifies whether to download the Boost source if it is not present in the specified location. The default is OFF.

    • -DDOWNLOAD_BOOST_TIMEOUT=seconds the timeout in seconds for downloading the Boost library. The default is 600 seconds.

    For example, if you normally build MySQL placing the object output in the bld subdirectory of your MySQL source tree, you can build with Boost like this:

    mkdir bld
    cd bld
    cmake .. -DDOWNLOAD_BOOST=ON -DWITH_BOOST=$HOME/my_boost
    

    This causes Boost to be downloaded into the my_boost directory under your home directory. If the required Boost version is already there, no download is done. If the required Boost version changes, the newer version is downloaded.

    If Boost is already installed locally and your compiler finds the Boost header files on its own, it may not be necessary to specify the preceding CMake options. However, if the version of Boost required by MySQL changes and the locally installed version has not been upgraded, you may have build problems. Using the CMake options should give you a successful build.

  • -DWITH_CLIENT_PROTOCOL_TRACING=bool

    Whether to build the client-side protocol tracing framework into the client library. By default, this option is enabled. This option was added in MySQL 5.7.2.

    For information about writing protocol trace client plugins, see Writing Protocol Trace Plugins.

    See also the WITH_TEST_TRACE_PLUGIN option.

  • -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.7.8, sync debug checking for the InnoDB storage engine is defined under UNIV_DEBUG and is available when debugging support is compiled in using the WITH_DEBUG option. When debugging support is compiled in, the innodb_sync_debug configuration option can be used to enable or disable InnoDB sync debug checking.

  • -DWITH_DEFAULT_FEATURE_SET=bool

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

  • -DWITH_EDITLINE=value

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

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

  • -DWITH_EMBEDDED_SERVER=bool

    Whether to build the libmysqld embedded server library.

  • -DWITH_EMBEDDED_SHARED_LIBRARY=bool

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

  • -DWITH_EXTRA_CHARSETS=name

    Which extra character sets to include:

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

    • complex: Complex character sets.

    • none: No extra character sets.

  • -DWITH_INNODB_EXTRA_DEBUG=bool

    Whether to include extra InnoDB debugging support.

    Enabling WITH_INNODB_EXTRA_DEBUG turns on extra InnoDB debug checks. This option can only be enabled when WITH_DEBUG is enabled.

  • -DWITH_INNODB_MEMCACHED=bool

    Whether to generate memcached shared libraries (libmemcached.so and innodb_engine.so).

  • -DWITH_KEYRING_TEST=bool

    Whether to build the test program that accompanies the keyring_file plugin. The default is OFF. Test file source code is located in the plugin/keyring/keyring-test directory.

    This option was added in MySQL 5.7.11.

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

  • -DWITH_LIBWRAP=bool

    Whether to include libwrap (TCP wrappers) support.

  • -DWITH_LZ4=lz4_type

    The WITH_LZ4 indicates the source of zlib support:

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

    • system: Use the system LZ4 library. If WITH_LZ4 is set to this value, the lz4_decompress utility is not built. In this case, the system lz4 command can be used instead.

  • -DWITH_MSAN=bool

    Whether to enable MemorySanitizer, for compilers that support it. The default is off.

    For this option to have an effect if enabled, all libraries linked to MySQL must also have been compiled with the option enabled.

    This option was added in MySQL 5.7.4.

  • -DWITH_MECAB={disabled|system|path_name}

    Use this option to compile the MeCab parser. If you have installed MeCab to its default installation directory, set -DWITH_MECAB=system. The system option applies to MeCab installations performed from source or from binaries using a native package management utility. If you installed MeCab to a custom installation directory, specify the path to the MeCab installation. For example, -DWITH_MECAB=/opt/mecab. If the system option does not work, specifying the MeCab installation path should work in all cases.

    For related information, see MeCab Full-Text Parser Plugin.

  • -DWITH_MSCRT_DEBUG=bool

    Whether to enable Visual Studio CRT memory leak tracing. The default is OFF. This option was added in MySQL 5.7.6.

  • -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.7.17.

  • -DWITH_PROTOBUF=protobuf_type

    Which Protocol Buffers package to use. protobuf_type can be one of the following values:

    • bundled: Use the package bundled with the distribution. This is the default.

    • system: Use the package installed on the system.

    Other values are ignored, with a fallback to bundled.

    This option was added in MySQL 5.7.12.

  • -DWITH_RAPID=bool

    Whether to build the rapid development cycle plugins. When enabled, a rapid directory is created in the build tree containing these plugins. When disabled, no rapid directory is created in the build tree. The default is ON, unless the rapid directory is removed from the source tree, in which case the default becomes OFF. This option was added in MySQL 5.7.12.

  • -DWITH_SSL={ssl_type|path_name}

    The type of SSL support to include or the path name to the OpenSSL installation to use.

    • ssl_type can be one of the following values:

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

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

      • system: Use the system SSL library.

    • path_name is the path name to the OpenSSL installation to use. Using this can be preferable to using the ssl_type value of system, for 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 the CMAKE_PREFIX_PATH option to path_name.)

    For information about using SSL support, see Using Secure Connections.

  • -DWITH_SYSTEMD=bool

    Whether to enable installation of systemd support files. By default, this option is disabled. When enabled, systemd support files are installed, and scripts such as mysqld_safe and the System V initialization script are not installed. On platforms where systemd is not available, enabling WITH_SYSTEMD results in an error from CMake.

    For more information about using systemd, see Managing MySQL Server with systemd. That section also includes information about specifying options previously specified in [mysqld_safe] option groups. Because mysqld_safe is not installed when systemd is used, such options must be specified another way.

    This option was added in MySQL 5.7.6.

  • -DWITH_TEST_TRACE_PLUGIN=bool

    Whether to build the test protocol trace client plugin (see Using the Test Protocol Trace Plugin). By default, this option is disabled. Enabling this option has no effect unless the WITH_CLIENT_PROTOCOL_TRACING option is enabled. If MySQL is configured with both options enabled, the libmysqlclient client library is built with the test protocol trace plugin built in, and all the standard MySQL clients load the plugin. However, even when the test plugin is enabled, it has no effect by default. Control over the plugin is afforded using environment variables; see Using the Test Protocol Trace Plugin.

    This option was added in MySQL 5.7.2.

    Note

    Do not enable the WITH_TEST_TRACE_PLUGIN option if you want to use your own protocol trace plugins because only one such plugin can be loaded at a time and an error occurs for attempts to load a second one. If you have already built MySQL with the test protocol trace plugin enabled to see how it works, you must rebuild MySQL without it before you can use your own plugins.

    For information about writing trace plugins, see Writing Protocol Trace Plugins.

  • -DWITH_UBSAN=bool

    Whether to enable the Undefined Behavior Sanitizer, for compilers that support it. The default is off. This option was added in MySQL 5.7.6.

  • -DWITH_UNIXODBC=1

    Enables unixODBC support, for Connector/ODBC.

  • -DWITH_VALGRIND=bool

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

  • -DWITHOUT_SERVER=bool

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

Compiler Flags

  • -DCMAKE_C_FLAGS="flags"

    Flags for the C Compiler.

  • -DCMAKE_CXX_FLAGS="flags"

    Flags for the C++ Compiler.

  • -DWITH_DEFAULT_COMPILER_OPTIONS=bool

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

    Note

    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. Example usage:

    cmake -DWITHOUT_SERVER=1 -DSUNPRO_CXX_LIBRARY=Cstd
    

    This option was added in MySQL 5.7.5.

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 \
         -DCMAKE_BUILD_TYPE=RelWithDebInfo

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" \
         -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g"

CMake Options for Compiling MySQL Cluster

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

  • -DMEMCACHED_HOME=dir_name

    Perform the build using the memcached (version 1.6 or later) installed in the system directory indicated by dir_name. Files from this installation that are used in the build include the memcached binary, header files, and libraries, as well as the memcached_utilities library and the header file engine_testapp.h.

    You must leave this option unset when building ndbmemcache using the bundled memcached sources (WITH_BUNDLED_MEMCACHED option); in other words, the bundled sources are used by default).

    While additional CMake options—such as for SASL authorization and for providing dtrace support—are available for use when compiling memcached from external sources, these options are currently not enabled for the memcached sources bundled with MySQL Cluster.

  • -DWITH_BUNDLED_LIBEVENT={ON|OFF}

    Use the libevent included in the MySQL Cluster sources when building MySQL Cluster with ndbmemcached support. Enabled by default. OFF causes the system's libevent to be used instead.

  • -DWITH_BUNDLED_MEMCACHED={ON|OFF}

    Build the memcached sources included in the MySQL Cluster source tree, then use the resulting memcached server when building the ndbmemcache engine. In this case, make install places the memcached binary in the installation bin directory, and the ndbmemcache engine shared library file ndb_engine.so in the installation lib directory.

    This option is ON by default.

  • -DWITH_CLASSPATH=path

    Sets the classpath for building MySQL Cluster Connector for Java. The default is empty. This option is ignored if -DWITH_NDB_JAVA=OFF is used.

  • -DWITH_ERROR_INSERT={ON|OFF}

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

  • -DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}

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

  • -DWITH_NDBCLUSTER={ON|OFF}

    This is an alias for WITH_NDBCLUSTER_STORAGE_ENGINE.

  • -DWITH_NDBMTD={ON|OFF}

    Build the multi-threaded data node executable ndbmtd. The default is ON.

  • -DWITH_NDB_BINLOG={ON|OFF}

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

  • -DWITH_NDB_DEBUG={ON|OFF}

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

  • -DWITH_NDB_JAVA={ON|OFF}

    Enable building MySQL Cluster with Java support, including ClusterJ.

    This option is ON by default. If you do not wish to compile MySQL 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 MySQL 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.

  • -DWITH_NDB_TEST={ON|OFF}

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


User Comments
Sign Up Login You must be logged in to post a comment.