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, “MySQL 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.
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 | |||
BUNDLE_RUNTIME_LIBRARIES |
Bundle runtime libraries with server MSI and Zip packages for Windows | OFF |
8.0.11 | |
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 | |||
COMPILATION_COMMENT_SERVER |
Comment about compilation environment for use by mysqld | 8.0.14 | ||
CPACK_MONOLITHIC_INSTALL |
Whether package build produces single file | OFF |
||
DEFAULT_CHARSET |
The default server character set | utf8mb4 |
||
DEFAULT_COLLATION |
The default server collation | utf8mb4_0900_ai_ci |
||
DISABLE_DATA_LOCK |
Exclude the performance schema data lock instrumentation | OFF |
||
DISABLE_PSI_COND |
Exclude Performance Schema condition instrumentation | OFF |
||
DISABLE_PSI_ERROR |
Exclude the performance schema server error instrumentation | OFF |
||
DISABLE_PSI_FILE |
Exclude Performance Schema file instrumentation | OFF |
||
DISABLE_PSI_IDLE |
Exclude Performance Schema idle instrumentation | OFF |
||
DISABLE_PSI_MEMORY |
Exclude Performance Schema memory instrumentation | OFF |
||
DISABLE_PSI_METADATA |
Exclude Performance Schema metadata instrumentation | OFF |
||
DISABLE_PSI_MUTEX |
Exclude Performance Schema mutex instrumentation | OFF |
||
DISABLE_PSI_PS |
Exclude the performance schema prepared statements | OFF |
||
DISABLE_PSI_RWLOCK |
Exclude Performance Schema rwlock instrumentation | OFF |
||
DISABLE_PSI_SOCKET |
Exclude Performance Schema socket instrumentation | OFF |
||
DISABLE_PSI_SP |
Exclude Performance Schema stored program instrumentation | OFF |
||
DISABLE_PSI_STAGE |
Exclude Performance Schema stage instrumentation | OFF |
||
DISABLE_PSI_STATEMENT |
Exclude Performance Schema statement instrumentation | OFF |
||
DISABLE_PSI_STATEMENT_DIGEST |
Exclude Performance Schema statements_digest instrumentation | OFF |
||
DISABLE_PSI_TABLE |
Exclude Performance Schema table instrumentation | OFF |
||
DISABLE_PSI_THREAD |
Exclude the performance schema thread instrumentation | OFF |
||
DISABLE_PSI_TRANSACTION |
Exclude the performance schema transaction instrumentation | OFF |
||
DISABLE_SHARED |
Do not build shared libraries, compile position-dependent code | OFF |
||
DOWNLOAD_BOOST |
Whether to download the Boost library | OFF |
||
DOWNLOAD_BOOST_TIMEOUT |
Timeout in seconds for downloading the Boost library | 600 |
||
ENABLED_LOCAL_INFILE |
Whether to enable LOCAL for LOAD DATA | OFF |
||
ENABLED_PROFILING |
Whether to enable query profiling code | ON |
||
ENABLE_DEBUG_SYNC |
Whether to enable Debug Sync support | ON |
8.0.1 | |
ENABLE_DOWNLOADS |
Whether to download optional files | OFF |
||
ENABLE_DTRACE |
Whether to include DTrace support | 8.0.1 | ||
ENABLE_EXPERIMENTAL_SYSVARS |
Whether to enabled experimental InnoDB system variables | OFF |
8.0.11 | |
ENABLE_GCOV |
Whether to include gcov support | |||
ENABLE_GPROF |
Enable gprof (optimized Linux builds only) | OFF |
||
FORCE_INSOURCE_BUILD |
Whether to force an in-source build | OFF |
8.0.14 | |
FORCE_UNSUPPORTED_COMPILER |
Whether to permit unsupported compiler | OFF |
||
IGNORE_AIO_CHECK |
With -DBUILD_CONFIG=mysql_release, ignore libaio check | OFF |
||
INSTALL_BINDIR |
User executables directory | PREFIX/bin |
||
INSTALL_DOCDIR |
Documentation directory | PREFIX/docs |
||
INSTALL_DOCREADMEDIR |
README file directory | PREFIX |
||
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_MYSQLKEYRINGDIR |
Directory for keyring_file plugin data file | platform specific |
||
INSTALL_MYSQLSHAREDIR |
Shared data directory | PREFIX/share |
||
INSTALL_MYSQLTESTDIR |
mysql-test directory | PREFIX/mysql-test |
||
INSTALL_PKGCONFIGDIR |
Directory for mysqlclient.pc pkg-config file | INSTALL_LIBDIR/pkgconfig |
||
INSTALL_PLUGINDIR |
Plugin directory | PREFIX/lib/plugin |
||
INSTALL_SBINDIR |
Server executable directory | PREFIX/bin |
||
INSTALL_SECURE_FILE_PRIVDIR |
secure_file_priv default value | platform specific |
||
INSTALL_SHAREDIR |
aclocal/mysql.m4 installation directory | PREFIX/share |
||
INSTALL_STATIC_LIBRARIES |
Whether to install static libraries | ON |
||
INSTALL_SUPPORTFILESDIR |
Extra support files directory | PREFIX/support-files |
||
LINK_RANDOMIZE |
Whether to randomize order of symbols in mysqld binary | OFF |
8.0.1 | |
LINK_RANDOMIZE_SEED |
Seed value for LINK_RANDOMIZE option | mysql |
8.0.1 | |
MAX_INDEXES |
Maximum indexes per table | 64 |
||
MUTEX_TYPE |
InnoDB mutex type | event |
||
MYSQLX_TCP_PORT |
TCP/IP port number used by X Plugin | 33060 |
||
MYSQLX_UNIX_ADDR |
Unix socket file used by X Plugin | /tmp/mysqlx.sock |
||
MYSQL_DATADIR |
Data directory | |||
MYSQL_MAINTAINER_MODE |
Whether to enable MySQL maintainer-specific development environment | OFF |
||
MYSQL_PROJECT_NAME |
Windows/OS X 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 | 8.0.11 | ||
SYSCONFDIR |
Option file directory | |||
SYSTEMD_PID_DIR |
Directory for PID file under systemd | /var/run/mysqld |
||
SYSTEMD_SERVICE_NAME |
Name of MySQL service under systemd | mysqld |
||
TMPDIR |
tmpdir default value | |||
USE_LD_GOLD |
Whether to use GNU gold linker | ON |
8.0.0 | |
USE_LD_LLD |
Whether to use llvm lld linker | ON |
8.0.16 | |
WIN_DEBUG_NO_INLINE |
Whether to disable function inlining | OFF |
||
WITHOUT_xxx_STORAGE_ENGINE |
Exclude storage engine xxx from build | |||
WITH_ANT |
Path to Ant for building GCS Java wrapper | 8.0.11 | ||
WITH_ASAN |
Enable AddressSanitizer | OFF |
||
WITH_ASAN_SCOPE |
Enable AddressSanitizer -fsanitize-address-use-after-scope Clang flag | OFF |
8.0.4 | |
WITH_AUTHENTICATION_LDAP |
Whether to report error if LDAP authentication plugins cannot be built | OFF |
8.0.2 | |
WITH_AUTHENTICATION_PAM |
Build PAM authentication plugin | OFF |
||
WITH_AWS_SDK |
Location of Amazon Web Services software development kit | 8.0.2 | ||
WITH_BOOST |
The location of the Boost library sources | |||
WITH_CLIENT_PROTOCOL_TRACING |
Build client-side protocol tracing framework | ON |
||
WITH_CURL |
Location of curl library | 8.0.2 | ||
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 |
||
WITH_GMOCK |
Path to googlemock distribution | |||
WITH_ICU |
Type of ICU support | bundled |
8.0.4 | |
WITH_INNODB_EXTRA_DEBUG |
Whether to include extra debugging support for InnoDB. | OFF |
||
WITH_INNODB_MEMCACHED |
Whether to generate memcached shared libraries. | OFF |
||
WITH_JEMALLOC |
Whether to link with -ljemalloc | OFF |
8.0.16 | |
WITH_KEYRING_TEST |
Build the keyring test program | OFF |
||
WITH_LIBEVENT |
Which libevent library to use | bundled |
||
WITH_LIBWRAP |
Whether to include libwrap (TCP wrappers) support | OFF |
||
WITH_LOCK_ORDER |
Whether to enable LOCK_ORDER tooling | OFF |
8.0.17 | |
WITH_LSAN |
Whether to run LeakSanitizer, without AddressSanitizer | OFF |
8.0.16 | |
WITH_LTO |
Enable link-time optimizer | OFF |
8.0.13 | |
WITH_LZ4 |
Type of LZ4 library support | bundled |
||
WITH_LZMA |
Type of LZMA library support | bundled |
8.0.4 | 8.0.16 |
WITH_MECAB |
Compiles MeCab | |||
WITH_MSAN |
Enable MemorySanitizer | OFF |
||
WITH_MSCRT_DEBUG |
Enable Visual Studio CRT memory leak tracing | OFF |
||
WITH_MYSQLX |
Whether to disable X Protocol | ON |
8.0.11 | |
WITH_NUMA |
Set NUMA memory allocation policy | |||
WITH_PROTOBUF |
Which Protocol Buffers package to use | bundled |
||
WITH_RAPID |
Whether to build rapid development cycle plugins | ON |
||
WITH_RAPIDJSON |
Type of RapidJSON support | bundled |
8.0.13 | |
WITH_RE2 |
Type of RE2 library support | bundled |
8.0.4 | 8.0.18 |
WITH_ROUTER |
Whether to build MySQL Router | ON |
8.0.16 | |
WITH_SSL |
Type of SSL support | system |
||
WITH_SYSTEMD |
Enable installation of systemd support files | OFF |
||
WITH_SYSTEM_LIBS |
Set system value of library options not set explicitly | OFF |
8.0.11 | |
WITH_TEST_TRACE_PLUGIN |
Build test protocol trace plugin | OFF |
||
WITH_TSAN |
Enable ThreadSanitizer | OFF |
||
WITH_UBSAN |
Enable Undefined Behavior Sanitizer | OFF |
||
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 |
This option configures a source distribution with the same build options used by Oracle to produce binary distributions for official MySQL releases.
-DBUNDLE_RUNTIME_LIBRARIES=
bool
Whether to bundle runtime libraries with server MSI and Zip packages for Windows.
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. This build type was added in MySQL 8.0.13.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
.
-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.
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, invoke CMake with
-DFORCE_INSOURCE_BUILD=ON
.
The CMAKE_INSTALL_PREFIX
option
indicates the base installation directory. Other options with
names of the form
INSTALL_
that
indicate component locations are interpreted relative to the
prefix and their values are relative pathnames. Their values
should not include the prefix.
xxx
-DCMAKE_INSTALL_PREFIX=
dir_name
The installation base directory.
This value can be set at server startup with the
--basedir
option.Where to install user programs.
Where to install documentation.
-DINSTALL_DOCREADMEDIR=
dir_name
Where to install
README
files.Where to install header files.
Where to install Info files.
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:
cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data
The
INSTALL_LAYOUT
value determines the default value of thesecure_file_priv
,keyring_encrypted_file_data
, andkeyring_file_data
system variables. See the descriptions of those variables in Section 5.1.8, “Server System Variables”, and Section 6.4.4.11, “Keyring System Variables”.Where to install library files.
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 theINSTALL_LAYOUT
CMake option; see the description of thekeyring_file_data
system variable in Section 5.1.8, “Server System Variables”.-DINSTALL_MYSQLSHAREDIR=
dir_name
Where to install shared data files.
-DINSTALL_MYSQLTESTDIR=
dir_name
Where to install the
mysql-test
directory. 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 isINSTALL_LIBDIR/pkgconfig
, unlessINSTALL_LIBDIR
ends with/mysql
, in which case that is removed first.The location of the plugin directory.
This value can be set at server startup with the
--plugin_dir
option.Where to install the mysqld server.
-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 theINSTALL_LAYOUT
CMake option; see the description of thesecure_file_priv
system variable in Section 5.1.8, “Server System Variables”.Where to install
aclocal/mysql.m4
.-DINSTALL_STATIC_LIBRARIES=
bool
Whether to install static libraries. The default is
ON
. If set toOFF
, these libraries are not installed:libmysqlclient.a
,libmysqlservices.a
.-DINSTALL_SUPPORTFILESDIR=
dir_name
Where to install extra support files.
Whether to randomize the order of symbols in the mysqld binary. The default is
OFF
. This option should be enabled only for debugging purposes.Seed value for the
LINK_RANDOMIZE
option. The value is a string. The default ismysql
, an arbitrary choice.The location of the MySQL data directory.
This value can be set at server startup with the
--datadir
option.The location of the ODBC includes directory, and may be used while configuring Connector/ODBC.
The location of the ODBC library directory, and may be used while configuring Connector/ODBC.
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=
option, wherefile_name
file_name
is the full path name to the file.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 theINSTALL_LAYOUT
value.This option is ignored unless
WITH_SYSTEMD
is enabled.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 theINSTALL_LAYOUT
value.This option is ignored unless
WITH_SYSTEMD
is enabled.The default location to use for the
tmpdir
system variable. If unspecified, the value defaults toP_tmpdir
in<stdio.h>
.
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_
.
Some permissible engine
_STORAGE_ENGINE=1engine
values are
ARCHIVE
, BLACKHOLE
,
EXAMPLE
, FEDERATED
, and
NDB
or NDBCLUSTER
(NDB
support). Examples:
-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
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_DATA_LOCK
DISABLE_PSI_ERROR
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.
To exclude a storage engine from the build, use
-DWITH_
.
Examples:
engine
_STORAGE_ENGINE=0
-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_
(but
engine
_STORAGE_ENGINE=1-DWITH_
is preferred). Examples:
engine
_STORAGE_ENGINE=0
-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
If neither
-DWITH_
nor
engine
_STORAGE_ENGINE-DWITHOUT_
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.
engine
_STORAGE_ENGINE
A descriptive comment about the compilation environment. As of MySQL 8.0.14, mysqld uses
COMPILATION_COMMENT_SERVER
. Other programs continue to useCOMPILATION_COMMENT
.-DCOMPILATION_COMMENT_SERVER=
string
A descriptive comment about the compilation environment for use by mysqld (for example, to set the
version_comment
system variable). This option was added in MySQL 8.0.14. Prior to 8.0.14, the server usesCOMPILATION_COMMENT
.-DDEFAULT_CHARSET=
charset_name
The server character set. By default, MySQL uses the
utf8mb4
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
,utf8
,utf8mb4
,utf16
,utf16le
,utf32
. The permissible character sets are listed in thecmake/character_sets.cmake
file as the value ofCHARSETS_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
utf8mb4_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.Whether to exclude the Performance Schema condition instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema file instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema idle instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema memory instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema metadata instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema mutex instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema rwlock instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema socket instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema stored program instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema stage instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema statement instrumentation. The default is
OFF
(include).-DDISABLE_PSI_STATEMENT_DIGEST=
bool
Whether to exclude the Performance Schema statement_digest instrumentation. The default is
OFF
(include).Whether to exclude the Performance Schema table instrumentation. The default is
OFF
(include).Whether to disable building build shared libraries and compile position-dependent code. The default is
OFF
(compile position-independent code).Enabling this option disables
-fPIC
, with the consequence that shared libraries are not built, including plugins and components. InvokingCMake
produces this warning:Dynamic plugins are disabled.
Exclude the performance schema prepared statements instances instrumentation. The default is
OFF
(include).Exclude the performance schema thread instrumentation. The default is
OFF
(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 is
OFF
(include).Exclude the performance schema data lock instrumentation. The default is
OFF
(include).Exclude the performance schema server error instrumentation. The default is
OFF
(include).Whether to download the Boost library. The default is
OFF
.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.
See the
WITH_BOOST
option for additional discussion about using Boost.As of MySQL 8.0.1,
ENABLE_DEBUG_SYNC
is removed and enablingWITH_DEBUG
enables Debug Sync.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, or Ant and JUnit required for building GCS Java wrapper.
Whether to include support for DTrace probes.
This option was removed in MySQL 8.0.1.
-DENABLE_EXPERIMENTAL_SYSVARS=
bool
Whether to enable experimental
InnoDB
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 for “PLUGIN_VAR_EXPERIMENTAL”.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 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 with
ENABLED_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), start mysqld withlocal_infile
disabled or enabled, respectively.local_infile
can also be set at runtime. See Section 6.1.6, “Security Issues with LOAD DATA LOCAL”.Whether to enable query profiling code (for the
SHOW PROFILE
andSHOW PROFILES
statements).-DFORCE_UNSUPPORTED_COMPILER=
bool
By default, CMake checks for minimum versions of supported compilers: Visual Studio 2015 (Windows); GCC 4.8 or Clang 3.4 (Linux); Developer Studio 12.5 (Solaris server); Developer Studio 12.4 or GCC 4.8 (Solaris client library); Clang 3.6 (macOS), Clang 3.4 (FreeBSD). To disable this check, use
-DFORCE_UNSUPPORTED_COMPILER=ON
.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
.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.
Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors.
The mutex type used by
InnoDB
. 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
onjects on Windows, if available.futex
: Use Linux futexes instead of condition variables to schedule waiting threads.
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 the
mysqlx_port
system variable.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 the
mysqlx_port
system variable.For Windows or macOS, the project name to incorporate into the project file name.
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.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 8.0.11. As of MySQL 8.0.12, it defaults to
ON
forRelWithDebInfo
builds.CMake causes the build process to link with the GNU gold linker if it is available and not explicitly disabled. To disable use of this linker, specify the
-DUSE_LD_GOLD=OFF
option.CMake causes the build process to link with the llvm lld linker for Clang if it is available and not explicitly disabled. To disable use of this linker, specify the
-DUSE_LD_LLD=OFF
option.This option was added in MySQL 8.0.16.
Whether to disable function inlining on Windows. The default is off (inlining enabled).
Set the path to Ant, required when building GCS Java wrapper. Works in a similar way to the existing
WITH_BOOST
CMake option. SetWITH_ANT
to the path of a directory where the Ant tarball, or an already unpacked archive, is saved. WhenWITH_ANT
is not set, or is set with the special valuesystem
, the build assumes a binary ant exists in$PATH
.Whether to enable the AddressSanitizer, for compilers that support it. The default is off.
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_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 andlibraries 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. (See Section 6.4.1.5, “PAM Pluggable Authentication”.) If this option is specified and the plugin cannot be compiled, the build fails.
The location of the Amazon Web Services software development kit.
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=
specifies the Boost library directory location. It is also possible to specify the Boost location by setting thepath_name
BOOST_ROOT
orWITH_BOOST
environment variable.-DWITH_BOOST=system
is also 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=
specifies whether to download the Boost source if it is not present in the specified location. The default isbool
OFF
.-DDOWNLOAD_BOOST_TIMEOUT=
the timeout in seconds for downloading the Boost library. The default is 600 seconds.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.
With the above settings that allow Boost download into a specified location, when the required Boost version changes, you need to remove the
bld
folder, recreate it, and perform the cmake step again. Otherwise, the new Boost version might not get downloaded, and compilation might fail.-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, see Section 29.2.4.11, “Writing Protocol Trace Plugins”.
See also the
WITH_TEST_TRACE_PLUGIN
option.The location of the curl library.
curl_type
can besystem
(use the system curl library) or a path name to the curl library.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 the
InnoDB
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.Enabling
WITH_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, start mysqld with the--debug-sync-timeout=
option, whereN
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.Sync debug checking for the
InnoDB
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, see MySQL Internals: Test Synchronization.
-DWITH_DEFAULT_FEATURE_SET=
bool
Whether to use the flags from
cmake/build_configurations/feature_set.cmake
.Which
libedit
/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. The
WITH_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.
Enabling
WITH_INNODB_EXTRA_DEBUG
turns on extra InnoDB debug checks. This option can only be enabled whenWITH_DEBUG
is enabled.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
and CMake will download 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 (
libmemcached.so
andinnodb_engine.so
).Whether to link with
-ljemalloc
. If enabled, built-inmalloc()
,calloc()
,realloc()
, andfree()
routines are disabled. The default isOFF
.This option was added in MySQL 8.0.16.
Whether to build the test program that accompanies the
keyring_file
plugin. The default isOFF
. Test file source code is located in theplugin/keyring/keyring-test
directory.Which
libevent
library to use. Permitted values arebundled
(default),system
, andyes
. If you specifysystem
oryes
, the systemlibevent
library is used if present. If the system library is not found, the bundledlibevent
library is used. Thelibevent
library is required byInnoDB
memcached.Whether to include
libwrap
(TCP wrappers) support.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 in Section 29.5.3, “The LOCK_ORDER Tool”.
NoteWith the
WITH_LOCK_ORDER
option enabled, MySQL builds require the flex program.This option was added in MySQL 8.0.17.
Whether to run LeakSanitizer, without AddressSanitizer. The default is
OFF
.This option was added in MySQL 8.0.16.
Whether to enable the link-time optimizer, if the compiler supports it. The default is
OFF
.This option was added in MySQL 8.0.13.
The
WITH_LZ4
indicates the source ofzlib
support:bundled
: Use thelz4
library bundled with the distribution. This is the default.system
: Use the systemlz4
library. IfWITH_LZ4
is set to this value, the lz4_decompress utility is not built. In this case, the system lz4 command can be used instead.
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_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, see Section 12.9.9, “MeCab Full-Text Parser Plugin”.
Whether to enable Visual Studio CRT memory leak tracing. The default is
OFF
.Whether to build with support for X Plugin. Default
ON
. See Chapter 20, Using MySQL as a Document Store.Explicitly set the NUMA memory allocation policy. CMake sets the default
WITH_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
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
.Whether to build the rapid development cycle plugins. When enabled, a
rapid
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 higher is required.
This option was added in MySQL 8.0.13.
The type of LZMA library support to include.
lzma_type
can be one of the following values:bundled
: Use the LZMA library bundled with the distribution. This is the default.system
: Use the system LZMA library.
This option was removed in MySQL 8.0.16.
The type of RE2 library support to include.
re2_type
can be one of the following values:bundled
: Use the RE2 library bundled with the distribution. This is the default.system
: Use the system RE2 library.
As of MySQL 8.0.18, MySQL no longer uses the RE2 library and this option was removed.
Whether to build MySQL Router. The default is
ON
.This option was added in MySQL 8.0.16.
-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:system
: Use the system OpenSSL library. This is the default.On macOS and Windows, using
system
builds as if CMake was invoked withpath_name
and points to the installed OpenSSL library. This is because they do not have system SSL libraries. On macOS, brew install openssl installs to/usr/local/opt/openssl
andsystem
will find it. On Windows, it checks %ProgramFiles%/OpenSSL, %ProgramFiles%/OpenSSL-Win32, %ProgramFiles%/OpenSSL-Win64, C:/OpenSSL, C:/OpenSSL-Win32, and C:/OpenSSL-Win64.yes
: This is a synonym forsystem
.wolfssl
: Use the wolfSSL library. To use this option value, you must follow the instructions in theextra/README-wolfssl.txt
file.
path_name
is the path name to the OpenSSL installation to use. This can be preferable to using thessl_type
value ofsystem
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 information about using SSL support, see Section 6.3, “Using Encrypted Connections”.
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 Section 2.5.9, “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 serves as an “umbrella” option to set the
system
value of any of the following CMake 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
.Whether to build the test protocol trace client plugin (see Section 29.2.4.11.1, “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, 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; see Section 29.2.4.11.1, “Using the Test Protocol Trace Plugin”.NoteDo 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 Section 29.2.4.11, “Writing Protocol Trace Plugins”.
Whether to enable the ThreadSanitizer, for compilers that support it. The default is off.
Whether to enable the Undefined Behavior Sanitizer, for compilers that support it. The default is off.
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.Some features require that the server be built with compression library support, such as the
COMPRESS()
andUNCOMPRESS()
functions, and compression of the client/server protocol. TheWITH_ZLIB
indicates the source ofzlib
support:bundled
: Use thezlib
library bundled with the distribution. This is the default.system
: Use the systemzlib
library. IfWITH_ZLIB
is set to this value, the zlib_decompress utility is not built. In this case, the system openssl zlib command can be used instead.
Flags for the C Compiler.
Flags for the C++ Compiler.
-DWITH_DEFAULT_COMPILER_OPTIONS=
bool
Whether to use the flags from
cmake/build_configurations/compiler_options.cmake
.NoteAll 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.
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 \
-DCMAKE_CXX_FLAGS=-m32 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo
If you set flags that affect optimization
(-O
), you must
set the
number
CMAKE_C_FLAGS_
and/or
build_type
CMAKE_CXX_FLAGS_
options, where build_type
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 .. -DCMAKE_C_FLAGS_RELWITHDEBINFO="-O3 -g" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O3 -g"
The following options are for use when building MySQL 8.0 sources with NDB Cluster support.
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 thememcached_utilities
library and the header fileengine_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 NDB Cluster.-DWITH_BUNDLED_LIBEVENT={ON|OFF}
Use the
libevent
included in the NDB Cluster sources when building NDB Cluster withndbmemcached
support. Enabled by default.OFF
causes the system'slibevent
to be used instead.-DWITH_BUNDLED_MEMCACHED={ON|OFF}
Build the memcached sources included in the NDB 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 installationbin
directory, and thendbmemcache
engine shared library filendb_engine.so
in the installationlib
directory.This option is ON by default.
Sets the classpath for building NDB Cluster Connector for Java. The default is empty. 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 isOFF
.-DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}
This is an alias for
WITH_NDBCLUSTER
.Build and link in support for the
NDB
(NDBCLUSTER
) storage engine in mysqld. The default isON
.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 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.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.
-DWITH_PLUGIN_NDBCLUSTER={ON|OFF}
Alias for
WITH_NDBCLUSTER
.