Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.4 Reference Manual  / ...  / Installing MySQL  / Installing MySQL from Source  /  MySQL Source-Configuration Options

2.8.7 MySQL Source-Configuration Options

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

$> cmake . -LH$> ccmake .

You can also affectCMake using certain environment variables. SeeSection 6.9, “Environment Variables”.

For boolean options, the value may be specified as1 orON to enable the option, or as0 orOFF to disable the option.

Many options configure compile-time defaults that can be overridden at server startup. For example, theCMAKE_INSTALL_PREFIX,MYSQL_TCP_PORT, andMYSQL_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 formysqld. Where applicable, configuration option descriptions indicate the correspondingmysqld startup option.

The following sections provide more information aboutCMake options.

CMake Option Reference

The following table shows the availableCMake options. In theDefault column,PREFIX stands for the value of theCMAKE_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.15 MySQL Source-Configuration Option Reference(CMake)

FormatsDescriptionDefault
ADD_GDB_INDEXWhether to enable generation of .gdb_index section in binaries
BUILD_CONFIGUse same build options as official releases
BUNDLE_RUNTIME_LIBRARIESBundle runtime libraries with server MSI and Zip packages for WindowsOFF
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
COMPILATION_COMMENT_SERVERComment about compilation environment for use by mysqld
COMPRESS_DEBUG_SECTIONSCompress debug sections of binary executablesOFF
CPACK_MONOLITHIC_INSTALLWhether package build produces single fileOFF
DEFAULT_CHARSETThe default server character setutf8mb4
DEFAULT_COLLATIONThe default server collationutf8mb4_0900_ai_ci
DISABLE_PERFSCHEMAEnable all DISABLE_PSI_* build options.OFF
DISABLE_PSI_CONDExclude Performance Schema condition instrumentationOFF
DISABLE_PSI_DATA_LOCKExclude the performance schema data lock instrumentationOFF
DISABLE_PSI_ERRORExclude the performance schema server error instrumentationOFF
DISABLE_PSI_FILEExclude Performance Schema file instrumentationOFF
DISABLE_PSI_IDLEExclude Performance Schema idle instrumentationOFF
DISABLE_PSI_MEMORYExclude Performance Schema memory instrumentationOFF
DISABLE_PSI_METADATAExclude Performance Schema metadata instrumentationOFF
DISABLE_PSI_MUTEXExclude Performance Schema mutex instrumentationOFF
DISABLE_PSI_PSExclude the performance schema prepared statementsOFF
DISABLE_PSI_RWLOCKExclude Performance Schema rwlock instrumentationOFF
DISABLE_PSI_SOCKETExclude Performance Schema socket instrumentationOFF
DISABLE_PSI_SPExclude Performance Schema stored program instrumentationOFF
DISABLE_PSI_STAGEExclude Performance Schema stage instrumentationOFF
DISABLE_PSI_STATEMENTExclude Performance Schema statement instrumentationOFF
DISABLE_PSI_STATEMENT_DIGESTExclude Performance Schema statements_digest instrumentationOFF
DISABLE_PSI_TABLEExclude Performance Schema table instrumentationOFF
DISABLE_PSI_THREADExclude the performance schema thread instrumentationOFF
DISABLE_PSI_TRANSACTIONExclude the performance schema transaction instrumentationOFF
ENABLED_LOCAL_INFILEWhether to enable LOCAL for LOAD DATAOFF
ENABLED_PROFILINGWhether to enable query profiling codeON
ENABLE_EXPERIMENTAL_SYSVARSWhether to enabled experimental InnoDB system variablesOFF
ENABLE_GCOVWhether to include gcov support
ENABLE_GPROFEnable gprof (optimized Linux builds only)OFF
FORCE_COLORED_OUTPUTWhether to colorize compiler outputOFF
FORCE_INSOURCE_BUILDWhether to force an in-source buildOFF
FORCE_UNSUPPORTED_COMPILERWhether to permit unsupported compilersOFF
FPROFILE_GENERATEWhether to generate profile guided optimization dataOFF
FPROFILE_USEWhether to use profile guided optimization dataOFF
HAVE_PSI_MEMORY_INTERFACEEnable performance schema memory tracing module for memory allocation functions used in dynamic storage of over-aligned typesOFF
IGNORE_AIO_CHECKWith -DBUILD_CONFIG=mysql_release, ignore libaio checkOFF
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_MYSQLSHAREDIRShared data directoryPREFIX/share
INSTALL_MYSQLTESTDIRmysql-test directoryPREFIX/mysql-test
INSTALL_PKGCONFIGDIRDirectory for mysqlclient.pc pkg-config fileINSTALL_LIBDIR/pkgconfig
INSTALL_PLUGINDIRPlugin directoryPREFIX/lib/plugin
INSTALL_PRIV_LIBDIRInstallation private library directory
INSTALL_SBINDIRServer executable directoryPREFIX/bin
INSTALL_SECURE_FILE_PRIVDIRsecure_file_priv default valueplatform specific
INSTALL_SHAREDIRaclocal/mysql.m4 installation directoryPREFIX/share
INSTALL_STATIC_LIBRARIESWhether to install static librariesON
INSTALL_SUPPORTFILESDIRExtra support files directoryPREFIX/support-files
LINK_RANDOMIZEWhether to randomize order of symbols in mysqld binaryOFF
LINK_RANDOMIZE_SEEDSeed value for LINK_RANDOMIZE optionmysql
MAX_INDEXESMaximum indexes per table64
MSVC_CPPCHECKEnable MSVC code analysis.ON
MUTEX_TYPEInnoDB mutex typeevent
MYSQLX_TCP_PORTTCP/IP port number used by X Plugin33060
MYSQLX_UNIX_ADDRUnix socket file used by X Plugin/tmp/mysqlx.sock
MYSQL_DATADIRData directory
MYSQL_MAINTAINER_MODEWhether to enable MySQL maintainer-specific development environmentOFF
MYSQL_PROJECT_NAMEWindows/macOS project nameMySQL
MYSQL_TCP_PORTTCP/IP port number3306
MYSQL_UNIX_ADDRUnix socket file/tmp/mysql.sock
NDB_UTILS_LINK_DYNAMICCause NDB tools to be dynamically linked to ndbclient
ODBC_INCLUDESODBC includes directory
ODBC_LIB_DIRODBC library directory
OPTIMIZER_TRACEWhether to support optimizer tracing
OPTIMIZE_SANITIZER_BUILDSWhether to optimize sanitizer buildsON
REPRODUCIBLE_BUILDTake extra care to create a build result independent of build location and time
SHOW_SUPPRESSED_COMPILER_WARNINGWhether to show suppressed compiler warnings and not fail with -Werror.OFF
SYSCONFDIROption file directory
SYSTEMD_PID_DIRDirectory for PID file under systemd/var/run/mysqld
SYSTEMD_SERVICE_NAMEName of MySQL service under systemdmysqld
TMPDIRtmpdir default value
WIN_DEBUG_NO_INLINEWhether to disable function inliningOFF
WITHOUT_SERVERDo not build the server; internal use onlyOFF
WITHOUT_xxx_STORAGE_ENGINEExclude storage engine xxx from build
WITH_ANTPath to Ant for building GCS Java wrapper
WITH_ASANEnable AddressSanitizerOFF
WITH_ASAN_SCOPEEnable AddressSanitizer -fsanitize-address-use-after-scope Clang flagOFF
WITH_AUTHENTICATION_CLIENT_PLUGINSEnabled automatically if any corresponding server authentication plugins are built
WITH_AUTHENTICATION_LDAPWhether to report error if LDAP authentication plugins cannot be builtOFF
WITH_AUTHENTICATION_PAMBuild PAM authentication pluginOFF
WITH_AWS_SDKLocation of Amazon Web Services software development kit
WITH_BUILD_IDOn Linux systems, generate a unique build IDON
WITH_CLASSPATHClasspath to use when building MySQL Cluster Connector for Java. Default is an empty string.
WITH_CLIENT_PROTOCOL_TRACINGBuild client-side protocol tracing frameworkON
WITH_CURLLocation of curl library
WITH_DEBUGWhether to include debugging supportOFF
WITH_DEFAULT_COMPILER_OPTIONSWhether to use default compiler optionsON
WITH_DEVELOPER_ENTITLEMENTSWhether to add the 'get-task-allow' entitlement to all executables on macOS to generate a core dump in the event of an unexpected server haltOFF
WITH_EDITLINEWhich libedit/editline library to usebundled
WITH_ERROR_INSERTEnable error injection in the NDB storage engine. Should not be used for building binaries intended for production.OFF
WITH_ICUType of ICU supportbundled
WITH_INNODB_EXTRA_DEBUGWhether to include extra debugging support for InnoDB.OFF
WITH_JEMALLOCWhether to link with -ljemallocOFF
WITH_LDWhether to use the LLVM lld or mold linker
WITH_LIBEVENTWhich libevent library to usebundled
WITH_LIBWRAPWhether to include libwrap (TCP wrappers) supportOFF
WITH_LOCK_ORDERWhether to enable LOCK_ORDER toolingOFF
WITH_LOG_DIAGNOSTICEnable diagnostic logging; internal use onlyOFF
WITH_LSANWhether to run LeakSanitizer, without AddressSanitizerOFF
WITH_LTOEnable link-time optimizerOFF
WITH_LZ4Type of LZ4 library supportbundled
WITH_MECABCompiles MeCab
WITH_MSANEnable MemorySanitizerOFF
WITH_MSCRT_DEBUGEnable Visual Studio CRT memory leak tracingOFF
WITH_MYSQLXWhether to disable X ProtocolON
WITH_NDBBuild MySQL NDB Cluster, including NDB storage engine and all NDB programsOFF
WITH_NDBAPI_EXAMPLESBuild API example programs.OFF
WITH_NDBCLUSTERNDB 8.0.30 and earlier: Build NDB storage engine. NDB 8.0.31 and later: Deprecated; use WITH_NDB insteadOFF
WITH_NDBCLUSTER_STORAGE_ENGINEPrior to NDB 8.0.31, this was for internal use only. NDB 8.0.31 and later: toggles (only) inclusion of NDBCLUSTER storage engineON
WITH_NDBMTDBuild multithreaded data node binaryON
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.ON
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_NDB_TLS_SEARCH_PATHDefault path used by NDB programs to search for TLS certificate and key files.$HOME/ndb-tls
WITH_NUMASet NUMA memory allocation policy
WITH_PACKAGE_FLAGSFor flags typically used for RPM/DEB packages, whether to add them to standalone builds on those platforms
WITH_PROTOBUFWhich Protocol Buffers package to usebundled
WITH_RAPIDWhether to build rapid development cycle pluginsON
WITH_RAPIDJSONType of RapidJSON supportbundled
WITH_ROUTERWhether to build MySQL RouterON
WITH_SASLInternal use only
WITH_SHOW_PARSE_TREESupport for SHOW PARSE_TREE debugging statement
WITH_SSLType of SSL supportsystem
WITH_SYSTEMDEnable installation of systemd support filesOFF
WITH_SYSTEMD_DEBUGEnable additional systemd debug informationOFF
WITH_SYSTEM_LIBSSet system value of library options not set explicitlyOFF
WITH_TCMALLOCWhether to link with -ltcmalloc. BUNDLED is supported on Linux onlyOFF
WITH_TEST_TRACE_PLUGINBuild test protocol trace pluginOFF
WITH_TSANEnable ThreadSanitizerOFF
WITH_UBSANEnable Undefined Behavior SanitizerOFF
WITH_UNIT_TESTSCompile MySQL with unit testsON
WITH_UNIXODBCEnable unixODBC supportOFF
WITH_VALGRINDWhether to compile in Valgrind header filesOFF
WITH_WIN_JEMALLOCPath to directory containing jemalloc.dll
WITH_ZLIBType of zlib supportbundled
WITH_ZSTDType of zstd supportbundled
WITH_xxx_STORAGE_ENGINECompile 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.

  • -DWITH_BUILD_ID=bool

    On Linux systems, generates a unique build ID which is used as the value of thebuild_id system variable and written to the MySQL server log on startup. Set this option toOFF to disable this feature.

    This option has no effect on platforms other than Linux.

  • -DBUNDLE_RUNTIME_LIBRARIES=bool

    Whether to bundle runtime libraries with server MSI and Zip packages for Windows.

  • -DCMAKE_BUILD_TYPE=type

    The type of build to produce:

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

    • Release: Enable optimizations but omit debugging information to reduce the build size.

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

    The option valuesNone andMinSizeRel are not supported.

  • -DCPACK_MONOLITHIC_INSTALL=bool

    This option affects whether themake 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.

  • -DFORCE_INSOURCE_BUILD=bool

    Defines whether to force an in-source build. Out-of-source builds are recommended, as they permit multiple builds from the same source, and cleanup can be performed quickly by removing the build directory. To force an in-source build, invokeCMake with-DFORCE_INSOURCE_BUILD=ON.

  • -DFORCE_COLORED_OUTPUT=bool

    Defines whether to enable colorized compiler output forgcc andclang when compiling on the command line. Defaults toOFF.

Installation Layout Options

TheCMAKE_INSTALL_PREFIX option indicates the base installation directory. Other options with names of the formINSTALL_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 theINSTALL PLUGIN statement or the--plugin-load option before it can be used). Some plugins might not support static or dynamic building.

TheInnoDB,MyISAM,MERGE,MEMORY, andCSV 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 permissibleengine values areARCHIVE,BLACKHOLE,EXAMPLE, andFEDERATED. Examples:

-DWITH_ARCHIVE_STORAGE_ENGINE=1-DWITH_BLACKHOLE_STORAGE_ENGINE=1

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

Note

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 followingCMake options:

DISABLE_PSI_CONDDISABLE_PSI_DATA_LOCKDISABLE_PSI_ERRORDISABLE_PSI_FILEDISABLE_PSI_IDLEDISABLE_PSI_MEMORYDISABLE_PSI_METADATADISABLE_PSI_MUTEXDISABLE_PSI_PSDISABLE_PSI_RWLOCKDISABLE_PSI_SOCKETDISABLE_PSI_SPDISABLE_PSI_STAGEDISABLE_PSI_STATEMENTDISABLE_PSI_STATEMENT_DIGESTDISABLE_PSI_TABLEDISABLE_PSI_THREADDISABLE_PSI_TRANSACTION

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

To exclude a storage engine from the build, use-DWITH_engine_STORAGE_ENGINE=0. Examples:

-DWITH_ARCHIVE_STORAGE_ENGINE=0-DWITH_EXAMPLE_STORAGE_ENGINE=0-DWITH_FEDERATED_STORAGE_ENGINE=0

It is also possible to exclude a storage engine from the build using-DWITHOUT_engine_STORAGE_ENGINE=1 (but-DWITH_engine_STORAGE_ENGINE=0 is preferred). Examples:

-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1-DWITHOUT_FEDERATED_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

  • -DADD_GDB_INDEX=bool

    This option determines whether to enable generation of a.gdb_index section in binaries, which makes loading them in a debugger faster. The option is disabled by default.lld linker is used, and is disabled by It has no effect if a linker other thanlld or GNUgold is used.

  • -DCOMPILATION_COMMENT=string

    A descriptive comment about the compilation environment. Whilemysqld usesCOMPILATION_COMMENT_SERVER, other programs useCOMPILATION_COMMENT.

  • -DCOMPRESS_DEBUG_SECTIONS=bool

    Whether to compress the debug sections of binary executables (Linux only). Compressing executable debug sections saves space at the cost of extra CPU time during the build process.

    The default isOFF. If this option is not set explicitly but theCOMPRESS_DEBUG_SECTIONS environment variable is set, the option takes its value from that variable.

  • -DCOMPILATION_COMMENT_SERVER=string

    A descriptive comment about the compilation environment for use bymysqld (for example, to set theversion_comment system variable). Programs other than the server useCOMPILATION_COMMENT.

  • -DDEFAULT_CHARSET=charset_name

    The server character set. By default, MySQL uses theutf8mb4 character set.

    charset_name may be one ofbinary,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,utf8mb3,utf8mb4,utf16,utf16le,utf32.

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

  • -DDEFAULT_COLLATION=collation_name

    The server collation. By default, MySQL usesutf8mb4_0900_ai_ci. Use theSHOW 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_PERFSCHEMA=bool

    Enable allDISABLE_PSI_* build options. This is the same as setting all such options toON.

    The default forDISABLE_PERFSCHEMA isOFF.

  • -DDISABLE_PSI_COND=bool

    Whether to exclude the Performance Schema condition instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_FILE=bool

    Whether to exclude the Performance Schema file instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_IDLE=bool

    Whether to exclude the Performance Schema idle instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_MEMORY=bool

    Whether to exclude the Performance Schema memory instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_METADATA=bool

    Whether to exclude the Performance Schema metadata instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_MUTEX=bool

    Whether to exclude the Performance Schema mutex instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_RWLOCK=bool

    Whether to exclude the Performance Schema rwlock instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_SOCKET=bool

    Whether to exclude the Performance Schema socket instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_SP=bool

    Whether to exclude the Performance Schema stored program instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_STAGE=bool

    Whether to exclude the Performance Schema stage instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_STATEMENT=bool

    Whether to exclude the Performance Schema statement instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_STATEMENT_DIGEST=bool

    Whether to exclude the Performance Schema statement digest instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_TABLE=bool

    Whether to exclude the Performance Schema table instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_PS=bool

    Exclude the Performance Schema prepared statements instances instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_THREAD=bool

    Exclude the Performance Schema thread instrumentation. The default isOFF (include).

    Only disable threads when building without any instrumentation, because other instrumentations have a dependency on threads.

  • -DDISABLE_PSI_TRANSACTION=bool

    Exclude the Performance Schema transaction instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_DATA_LOCK=bool

    Exclude the performance schema data lock instrumentation. The default isOFF (include).

  • -DDISABLE_PSI_ERROR=bool

    Exclude the performance schema server error instrumentation. The default isOFF (include).

  • -DENABLE_EXPERIMENTAL_SYSVARS=bool

    Whether to enable experimentalInnoDB system variables. Experimental system variables are intended for those engaged in MySQL development, should only be used in a development or test environment, and may be removed without notice in a future MySQL release. For information about experimental system variables, refer to/storage/innobase/handler/ha_innodb.cc in the MySQL source tree. Experimental system variables can be identified by searching forPLUGIN_VAR_EXPERIMENTAL.

  • -DENABLE_GCOV=bool

    Whether to includegcov support (Linux only).

  • -DENABLE_GPROF=bool

    Whether to enablegprof (optimized Linux builds only).

  • -DENABLED_LOCAL_INFILE=bool

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

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

    ENABLED_LOCAL_INFILE controls the default for client-sideLOCAL capability. For the server, thelocal_infile system variable controls server-sideLOCAL capability. To explicitly cause the server to refuse or permitLOAD DATA LOCAL statements (regardless of how client programs and libraries are configured at build time or runtime), startmysqld with--local-infile disabled or enabled, respectively.local_infile can also be set at runtime. SeeSection 8.1.6, “Security Considerations for LOAD DATA LOCAL”.

  • -DENABLED_PROFILING=bool

    Whether to enable query profiling code (for theSHOW PROFILE andSHOW PROFILES statements).

  • -DFORCE_UNSUPPORTED_COMPILER=bool

    By default,CMake checks for minimum versions ofsupported compilers; to disable this check, use-DFORCE_UNSUPPORTED_COMPILER=ON.

  • -DFPROFILE_GENERATE=bool

    Whether to generate profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. Seecmake/fprofile.cmake in the MySQL source distribution for information about usingFPROFILE_GENERATE andFPROFILE_USE. These options have been tested with GCC 8 and 9.

  • -DFPROFILE_USE=bool

    Whether to use profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. See thecmake/fprofile.cmake file in a MySQL source distribution for information about usingFPROFILE_GENERATE andFPROFILE_USE. These options have been tested with GCC 8 and 9.

    EnablingFPROFILE_USE also enablesWITH_LTO.

  • -DHAVE_PSI_MEMORY_INTERFACE=bool

    Whether to enable the performance schema memory tracing module for memory allocation functions (ut::aligned_name library functions) used in dynamic storage of over-aligned types.

  • -DIGNORE_AIO_CHECK=bool

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

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

  • -DWITH_DEVELOPER_ENTITLEMENTS=bool

    Whether to add theget-task-allow entitlement to all executables to generate a core dump in the event of an unexpected server halt.

    On macOS 11+, core dumps are limited to processes with thecom.apple.security.get-task-allow entitlement, which this CMake option enables. The entitlement allows other processes to attach and read/modify the processes memory, and allows--core-file to function as expected.

  • -DMUTEX_TYPE=type

    The mutex type used byInnoDB. Options include:

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

    • sys: Use POSIX mutexes on UNIX systems. UseCRITICAL_SECTION objects on Windows, if available.

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

  • -DMYSQLX_TCP_PORT=port_num

    The port number on which X Plugin listens for TCP/IP connections. The default is 33060.

    This value can be set at server startup with themysqlx_port system variable.

  • -DMYSQLX_UNIX_ADDR=file_name

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

    This value can be set at server startup with themysqlx_port system variable.

  • -DMYSQL_PROJECT_NAME=name

    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.

  • -DOPTIMIZER_TRACE=bool

    Whether to support optimizer tracing. SeeSection 10.15, “Tracing the Optimizer”.

  • -DREPRODUCIBLE_BUILD=bool

    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 defaults toON forRelWithDebInfo builds.

  • -DSHOW_SUPPRESSED_COMPILER_WARNINGS=bool

    Show suppressed compiler warnings, and do so without failing with-Werror. Defaults toOFF.

  • -DWIN_DEBUG_NO_INLINE=bool

    Whether to disable function inlining on Windows. The default isOFF (inlining enabled).

  • -DWITH_LD=string

    CMake uses the standard linker by default. Optionally pass inlld ormold to specify an alternative linker.mold must be version 2 or newer.

    This option can be used on Linux-based systems other than Enterprise Linux, which always uses theld linker.

    Note

    Previously, the optionUSE_LD_LLD could be used to enable (the default) or disable explicitly the LLVMlld linker for Clang. In MySQL 8.3,USE_LD_LLD has been removed.

  • -DWITH_ANT=path_name

    Set the path to Ant, required when building GCS Java wrapper. SetWITH_ANT to the path of a directory where the Ant tarball or unpacked archive is saved. WhenWITH_ANT is not set, or is set with the special valuesystem, the build process assumes a binaryant exists in$PATH.

  • -DWITH_ASAN=bool

    Whether to enable the AddressSanitizer, for compilers that support it. The default isOFF.

  • -DWITH_ASAN_SCOPE=bool

    Whether to enable the AddressSanitizer-fsanitize-address-use-after-scope Clang flag for use-after-scope detection. The default is off. To use this option,-DWITH_ASAN must also be enabled.

  • -DWITH_AUTHENTICATION_CLIENT_PLUGINS=bool

    This option is enabled automatically if any corresponding server authentication plugins are built. Its value thus depends on otherCMake options and it should not be set explicitly.

  • -DWITH_AUTHENTICATION_LDAP=bool

    Whether to report an error if the LDAP authentication plugins cannot be built:

    • If this option is disabled (the default), the LDAP plugins are built if the required header files and libraries are found. If they are not,CMake displays a note about it.

    • If this option is enabled, a failure to find the required header file and libraries causes CMake to produce an error, preventing the server from being built.

  • -DWITH_AUTHENTICATION_PAM=bool

    Whether to build the PAM authentication plugin, for source trees that include this plugin. (SeeSection 8.4.1.4, “PAM Pluggable Authentication”.) If this option is specified and the plugin cannot be compiled, the build fails.

  • -DWITH_AWS_SDK=path_name

    The location of the Amazon Web Services software development kit.

  • -DWITH_CLIENT_PROTOCOL_TRACING=bool

    Whether to build the client-side protocol tracing framework into the client library. By default, this option is enabled.

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

    See also theWITH_TEST_TRACE_PLUGIN option.

  • -DWITH_CURL=curl_type

    The location of thecurl library.curl_type can besystem (use the systemcurl library), a path name to thecurl library,no|off|none to disable curl support, orbundled to use the bundled curl distribution inextra/curl/.

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

    Sync debug checking for theInnoDB storage engine is defined underUNIV_DEBUG and is available when debugging support is compiled in using theWITH_DEBUG option. When debugging support is compiled in, theinnodb_sync_debug configuration option can be used to enable or disableInnoDB sync debug checking.

    EnablingWITH_DEBUG also enables Debug Sync. This facility is used for testing and debugging. When compiled in, Debug Sync is disabled by default at runtime. To enable it, startmysqld with the--debug-sync-timeout=N option, whereN 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.

    Sync debug checking for theInnoDB storage engine is available when debugging support is compiled in using theWITH_DEBUG option.

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

  • -DWITH_LOG_DIAGNOSTIC

    Enable server diagnostic logging options (--log-diagnostic-enable and--log-diagnostic). For internal use only.

  • -DWITH_EDITLINE=value

    Whichlibedit/editline library to use. The permitted values arebundled (the default) andsystem.

  • -DWITH_ICU={icu_type|path_name}

    MySQL uses International Components for Unicode (ICU) to support regular expression operations. TheWITH_ICU option indicates the type of ICU support to include or the path name to the ICU installation to use.

    • icu_type can be one of the following values:

      • bundled: Use the ICU library bundled with the distribution. This is the default, and is the only supported option for Windows.

      • system: Use the system ICU library.

    • path_name is the path name to the ICU installation to use. This can be preferable to using theicu_type value ofsystem because it can prevent CMake from detecting and using an older or incorrect ICU version installed on the system. (Another permitted way to do the same thing is to setWITH_ICU tosystem and set theCMAKE_PREFIX_PATH option topath_name.)

  • -DWITH_INNODB_EXTRA_DEBUG=bool

    Whether to include extra InnoDB debugging support.

    EnablingWITH_INNODB_EXTRA_DEBUG turns on extra InnoDB debug checks. This option can only be enabled whenWITH_DEBUG is enabled.

  • -DWITH_JEMALLOC=bool

    Whether to link with-ljemalloc. If enabled, built-inmalloc(),calloc(),realloc(), andfree() routines are disabled. The default isOFF.

    WITH_JEMALLOC andWITH_TCMALLOC are mutually exclusive.

  • -DWITH_LIBEVENT=string

    Whichlibevent library to use. Permitted values arebundled (default) andsystem. Ifsystem is specified and no systemlibevent library can be found, an error occurs regardless, and the bundledlibevent is not used.

    Thelibevent library is required by X Plugin and MySQL Router.

  • -DWITH_LIBWRAP=bool

    Whether to includelibwrap (TCP wrappers) support.

  • -DWITH_LOCK_ORDER=bool

    Whether to enable LOCK_ORDER tooling. By default, this option is disabled and server builds contain no tooling. If tooling is enabled, the LOCK_ORDER tool is available and can be used as described inSection 7.9.3, “The LOCK_ORDER Tool”.

    Note

    With theWITH_LOCK_ORDER option enabled, MySQL builds require theflex program.

  • -DWITH_LSAN=bool

    Whether to run LeakSanitizer, without AddressSanitizer. The default isOFF.

  • -DWITH_LTO=bool

    Whether to enable the link-time optimizer, if the compiler supports it. The default isOFF unlessFPROFILE_USE is enabled.

  • -DWITH_LZ4=lz4_type

    TheWITH_LZ4 option indicates the source ofzlib support:

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

    • system: Use the systemlz4 library.

  • -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. Thesystem 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 thesystem option does not work, specifying the MeCab installation path should work in all cases.

    For related information, seeSection 14.9.9, “MeCab Full-Text Parser Plugin”.

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

  • -DWITH_MSCRT_DEBUG=bool

    Whether to enable Visual Studio CRT memory leak tracing. The default isOFF.

  • -DMSVC_CPPCHECK=bool

    Whether to enable MSVC code analysis. The default isON.

  • -DWITH_MYSQLX=bool

    Whether to build with support for X Plugin. The default isON. SeeChapter 22,Using MySQL as a Document Store.

  • -DWITH_NUMA=bool

    Explicitly set the NUMA memory allocation policy.CMake sets the defaultWITH_NUMA value based on whether the current platform hasNUMA 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.

  • -DWITH_PACKAGE_FLAGS=bool

    For flags typically used for RPM and Debian packages, whether to add them to standalone builds on those platforms. The default isON for nondebug builds.

  • -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. Optionally useINSTALL_PRIV_LIBDIR to modify the dynamic Protobuf library directory.

    • system: Use the package installed on the system.

    Other values are ignored, with a fallback tobundled.

  • -DWITH_RAPID=bool

    Whether to build the rapid development cycle plugins. When enabled, arapid directory is created in the build tree containing these plugins. When disabled, norapid directory is created in the build tree. The default isON, unless therapid directory is removed from the source tree, in which case the default becomesOFF.

  • -DWITH_RAPIDJSON=rapidjson_type

    The type of RapidJSON library support to include.rapidjson_type can be one of the following values:

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

    • system: Use the system RapidJSON library. Version 1.1.0 or later is required.

  • -DWITH_ROUTER=bool

    Whether to build MySQL Router. The default isON.

  • -DWITH_SASL=value

    Internal use only. Not supported on Windows.

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

      • system: Use the system OpenSSL library. This is the default.

        On macOS and Windows, usingsystem configures MySQL to build as if CMake was invoked withpath_name points to a manually installed OpenSSL library. This is because they do not have system SSL libraries. On macOS,brew install openssl installs to/usr/local/opt/openssl so thatsystem can find it. On Windows, it checks%ProgramFiles%/OpenSSL,%ProgramFiles%/OpenSSL-Win32,%ProgramFiles%/OpenSSL-Win64,C:/OpenSSL,C:/OpenSSL-Win32, andC:/OpenSSL-Win64.

      • yes: This is a synonym forsystem.

      • opensslversion: Use an alternate OpenSSL system package such asopenssl11 on EL7, oropenssl3 (oropenssl3-fips) on EL8.

        Authentication plugins, such as LDAP and Kerberos, are disabled as they do not support these alternative versions of OpenSSL.

    • path_name is the path name to the OpenSSL installation to use. This can be preferable to using thessl_type valuesystem 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 setWITH_SSL tosystem and set theCMAKE_PREFIX_PATH option topath_name.)

    For additional information about configuring the SSL library, seeSection 2.8.6, “Configuring SSL Library Support”.

  • -DWITH_SHOW_PARSE_TREE=bool

    Enables support forSHOW PARSE_TREE in the server, used in development and debugging only. Not used for release builds or supported in production.

  • -DWITH_SYSTEMD=bool

    Whether to enable installation ofsystemd support files. By default, this option is disabled. When enabled,systemd support files are installed, and scripts such asmysqld_safe and the System V initialization script are not installed. On platforms wheresystemd is not available, enablingWITH_SYSTEMD results in an error fromCMake.

    When the server was built using this option, MySQL includes allsystemd messages in the server's error log (seeSection 7.4.2, “The Error Log”).

    For more information about usingsystemd, seeSection 2.5.9, “Managing MySQL Server with systemd”. That section also includes information about specifying options otherwise specified in[mysqld_safe] option groups. Becausemysqld_safe is not installed whensystemd is used, such options must be specified another way.

  • -DWITH_SYSTEM_LIBS=bool

    This option serves as anumbrella option to set thesystem value of any of the followingCMake options that are not set explicitly:WITH_CURL,WITH_EDITLINE,WITH_ICU,WITH_LIBEVENT,WITH_LZ4,WITH_LZMA,WITH_PROTOBUF,WITH_RE2,WITH_SSL,WITH_ZLIB,WITH_ZSTD.

  • -DWITH_SYSTEMD_DEBUG=bool

    Whether to produce additionalsystemd debugging information, for platforms on whichsystemd is used to run MySQL. The default isOFF.

  • -DWITH_TCMALLOC=bool

    Whether to link with-ltcmalloc. If enabled, built-inmalloc(),calloc(),realloc(), andfree() routines are disabled. The default isOFF.

    Atcmalloc library is included in the source; you can cause the build to use the bundled version by setting this option toBUNDLED.BUNDLED is supported on Linux systems only.

    WITH_TCMALLOC andWITH_JEMALLOC are mutually exclusive.

  • -DWITH_TEST_TRACE_PLUGIN=bool

    Whether to build the test protocol trace client plugin (seeUsing the Test Protocol Trace Plugin). By default, this option is disabled. Enabling this option has no effect unless theWITH_CLIENT_PROTOCOL_TRACING option is enabled. If MySQL is configured with both options enabled, thelibmysqlclient 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; seeUsing the Test Protocol Trace Plugin.

    Note

    Donot enable theWITH_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, seeWriting Protocol Trace Plugins.

  • -DWITH_TSAN=bool

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

  • -DWITH_UBSAN=bool

    Whether to enable the Undefined Behavior Sanitizer, for compilers that support it. The default is off.

  • -DWITH_UNIT_TESTS={ON|OFF}

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

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

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

  • -DWITH_WIN_JEMALLOC=string

    On Windows, pass in a path to a directory containingjemalloc.dll to enable jemalloc functionality. The build system copiesjemalloc.dll to the same directory asmysqld.exe and/ormysqld-debug.exe and utilizes it for memory management operations. Standard memory functions are used ifjemalloc.dll is not found or does not export the required functions. An INFORMATION level log message records whether or not jemalloc is found and used.

    This option is enabled for official MySQL binaries for Windows.

  • -DWITH_ZLIB=zlib_type

    Some features require that the server be built with compression library support, such as theCOMPRESS() andUNCOMPRESS() functions, and compression of the client/server protocol. TheWITH_ZLIB option indicates the source ofzlib support:

    The minimum supported version ofzlib is 1.2.13.

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

    • system: Use the systemzlib library.

  • -DWITH_ZSTD=zstd_type

    Connection compression using thezstd algorithm (seeSection 6.2.8, “Connection Compression Control”) requires that the server be built withzstd library support. TheWITH_ZSTD option indicates the source ofzstd support:

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

    • system: Use the systemzstd library.

  • -DWITHOUT_SERVER=bool

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

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

    This option also prevents building of theNDB storage engine or anyNDB binaries including management and data node programs.

Compiler Flags

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

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

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

$> mkdir build$> cd build$> cmake .. -DCMAKE_C_FLAGS=-m32 \  -DCMAKE_CXX_FLAGS=-m32 \  -DCMAKE_BUILD_TYPE=RelWithDebInfo

If you set flags that affect optimization (-Onumber), you must set theCMAKE_C_FLAGS_build_type and/orCMAKE_CXX_FLAGS_build_type options, wherebuild_type corresponds to theCMAKE_BUILD_TYPE value. To specify a different optimization for the default build type (RelWithDebInfo) set theCMAKE_C_FLAGS_RELWITHDEBINFO andCMAKE_CXX_FLAGS_RELWITHDEBINFO options. For example, to compile on Linux with-O3 and with debug symbols, do this:

$> cmake .. -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g" \  -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g"

CMake Options for Compiling NDB Cluster

To compile MySQL with support for NDB Cluster, you can use-DWITH_NDB, which causes the build to include the NDB storage engine and all NDB programs. This option is enabled by default. To prevent building of the NDB storage engine plugin, use-DWITH_NDBCLUSTER_STORAGE_ENGINE=OFF. Other aspects of the build can be controlled using the other options listed in this section.

The following options apply when building the MySQL sources with NDB Cluster support.

  • -DNDB_UTILS_LINK_DYNAMIC={ON|OFF}

    Controls whether NDB utilities such asndb_drop_table are linked withndbclient statically (OFF) or dynamically (ON);OFF (static linking) is the default. Normally static linking is used when building these to avoid problems withLD_LIBRARY_PATH, or when multiple versions ofndbclient are installed. This option is intended for creating Docker images and possibly other cases in which the target environment is subject to precise control and it is desirable to reduce image size.

  • -DWITH_CLASSPATH=path

    Sets the classpath for building MySQL NDB 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 theNDB kernel. For testing only; not intended for use in building production binaries. The default isOFF.

  • -DWITH_NDB={ON|OFF}

    Build MySQL NDB Cluster; build the NDB plugin and all NDB Cluster programs.

  • -DWITH_NDBAPI_EXAMPLES={ON|OFF}

    Build NDB API example programs instorage/ndb/ndbapi-examples/. SeeNDB API Examples, for information about these.

  • -DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}

    Controls (only) whether thendbcluster plugin is included in the build;WITH_NDB enables this option automatically, so it is recommended that you useWITH_NDB instead.

  • -DWITH_NDBCLUSTER={ON|OFF} (DEPRECATED)

    Build and link in support for theNDB storage engine inmysqld.

    This option is deprecated and subject to eventual removal; useWITH_NDB instead.

  • -DWITH_NDBMTD={ON|OFF}

    Build the multithreaded data node executablendbmtd. The default isON.

  • -DWITH_NDB_DEBUG={ON|OFF}

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

  • -DWITH_NDB_JAVA={ON|OFF}

    Enable building NDB Cluster with Java support, including support for ClusterJ (seeMySQL NDB Cluster Connector for Java).

    This option isON 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 runningCMake. 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 thisport 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 isOFF.

  • -DWITH_NDB_TLS_SEARCH_PATH=path

    Set the default path searched byndb_sign_keys and otherNDB programs for TLS certificate and key files.

    The default for Windows platforms is$HOMEDIR/ndb-tls; for other platforms, such as Linux, it is$HOME/ndb-tls.