2.8.7 MySQL Source-Configuration Options
MySQL 8.4 Reference Manual Including MySQL NDB Cluster 8.4
2.8.7 MySQL Source-Configuration Options
The CMake program provides a great deal of control over how you configure a MySQL source distribution. Typically, you do this using options on the CMake command line. For information about options supported by CMake, run either of these commands in the top-level source directory:
$> cmake . -LH
$> ccmake .
You can also affect CMake using certain environment variables. See Section 6.9, “Environment Variables”.
For boolean options, the value may be specified as
1 or ON to enable the
option, or as 0 or OFF to
disable the option.
Many options configure compile-time defaults that can be
overridden at server startup. For example, the
CMAKE_INSTALL_PREFIX,
MYSQL_TCP_PORT, and
MYSQL_UNIX_ADDR options that
configure the default installation base directory location, TCP/IP
port number, and Unix socket file can be changed at server startup
with the --basedir,
--port, and
--socket options for
mysqld. Where applicable, configuration option
descriptions indicate the corresponding mysqld
startup option.
The following sections provide more information about CMake options.
- CMake Option Reference
- General Options
- Installation Layout Options
- Storage Engine Options
- Feature Options
- Compiler Flags
- CMake Options for Compiling NDB Cluster
CMake Option Reference
The following table shows the available CMake
options. In the Default column,
PREFIX stands for the value of the
CMAKE_INSTALL_PREFIX option, which
specifies the installation base directory. This value is used as
the parent location for several of the installation
subdirectories.
Table 2.15 MySQL Source-Configuration Option Reference (CMake)
| Formats | Description | Default |
|---|---|---|
ADD_GDB_INDEX |
Whether to enable generation of .gdb_index section in binaries | |
BUILD_CONFIG |
Use same build options as official releases | |
BUNDLE_RUNTIME_LIBRARIES |
Bundle runtime libraries with server MSI and Zip packages for Windows | OFF |
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 | |
COMPRESS_DEBUG_SECTIONS |
Compress debug sections of binary executables | OFF |
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_PSI_COND |
Exclude Performance Schema condition instrumentation | OFF |
DISABLE_PSI_DATA_LOCK |
Exclude the performance schema data lock 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 |
ENABLED_LOCAL_INFILE |
Whether to enable LOCAL for LOAD DATA | OFF |
ENABLED_PROFILING |
Whether to enable query profiling code | ON |
ENABLE_EXPERIMENTAL_SYSVARS |
Whether to enabled experimental InnoDB system variables | OFF |
ENABLE_GCOV |
Whether to include gcov support | |
ENABLE_GPROF |
Enable gprof (optimized Linux builds only) | OFF |
FORCE_COLORED_OUTPUT |
Whether to colorize compiler output | OFF |
FORCE_INSOURCE_BUILD |
Whether to force an in-source build | OFF |
FORCE_UNSUPPORTED_COMPILER |
Whether to permit unsupported compilers | OFF |
FPROFILE_GENERATE |
Whether to generate profile guided optimization data | OFF |
FPROFILE_USE |
Whether to use profile guided optimization data | OFF |
HAVE_PSI_MEMORY_INTERFACE |
Enable performance schema memory tracing module for memory allocation functions used in dynamic storage of over-aligned types | 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_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_PRIV_LIBDIR |
Installation private library directory | |
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 |
LINK_RANDOMIZE_SEED |
Seed value for LINK_RANDOMIZE option | mysql |
MAX_INDEXES |
Maximum indexes per table | 64 |
MSVC_CPPCHECK |
Enable MSVC code analysis. | ON |
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/macOS project name | MySQL |
MYSQL_TCP_PORT |
TCP/IP port number | 3306 |
MYSQL_UNIX_ADDR |
Unix socket file | /tmp/mysql.sock |
NDB_UTILS_LINK_DYNAMIC |
Cause NDB tools to be dynamically linked to ndbclient | |
ODBC_INCLUDES |
ODBC includes directory | |
ODBC_LIB_DIR |
ODBC library directory | |
OPTIMIZER_TRACE |
Whether to support optimizer tracing | |
OPTIMIZE_SANITIZER_BUILDS |
Whether to optimize sanitizer builds | ON |
REPRODUCIBLE_BUILD |
Take extra care to create a build result independent of build location and time | |
SHOW_SUPPRESSED_COMPILER_WARNING |
Whether to show suppressed compiler warnings and not fail with -Werror. | OFF |
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 | |
WIN_DEBUG_NO_INLINE |
Whether to disable function inlining | OFF |
WITHOUT_SERVER |
Do not build the server; internal use only | OFF |
WITHOUT_xxx_STORAGE_ENGINE |
Exclude storage engine xxx from build | |
WITH_ANT |
Path to Ant for building GCS Java wrapper | |
WITH_ASAN |
Enable AddressSanitizer | OFF |
WITH_ASAN_SCOPE |
Enable AddressSanitizer -fsanitize-address-use-after-scope Clang flag | OFF |
WITH_AUTHENTICATION_CLIENT_PLUGINS |
Enabled automatically if any corresponding server authentication plugins are built | |
WITH_AUTHENTICATION_LDAP |
Whether to report error if LDAP authentication plugins cannot be built | OFF |
WITH_AUTHENTICATION_PAM |
Build PAM authentication plugin | OFF |
WITH_AWS_SDK |
Location of Amazon Web Services software development kit | |
WITH_BUILD_ID |
On Linux systems, generate a unique build ID | ON |
WITH_CLASSPATH |
Classpath to use when building MySQL Cluster Connector for Java. Default is an empty string. | |
WITH_CLIENT_PROTOCOL_TRACING |
Build client-side protocol tracing framework | ON |
WITH_CURL |
Location of curl library | |
WITH_DEBUG |
Whether to include debugging support | OFF |
WITH_DEFAULT_COMPILER_OPTIONS |
Whether to use default compiler options | ON |
WITH_DEVELOPER_ENTITLEMENTS |
Whether to add the 'get-task-allow' entitlement to all executables on macOS to generate a core dump in the event of an unexpected server halt | OFF |
WITH_EDITLINE |
Which libedit/editline library to use | bundled |
WITH_ERROR_INSERT |
Enable error injection in the NDB storage engine. Should not be used for building binaries intended for production. | OFF |
WITH_ICU |
Type of ICU support | bundled |
WITH_INNODB_EXTRA_DEBUG |
Whether to include extra debugging support for InnoDB. | OFF |
WITH_JEMALLOC |
Whether to link with -ljemalloc | OFF |
WITH_LD |
Whether to use the LLVM lld or mold linker | |
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 |
WITH_LSAN |
Whether to run LeakSanitizer, without AddressSanitizer | OFF |
WITH_LTO |
Enable link-time optimizer | OFF |
WITH_LZ4 |
Type of LZ4 library support | bundled |
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 |
WITH_NDB |
Build MySQL NDB Cluster, including NDB storage engine and all NDB programs | OFF |
WITH_NDBAPI_EXAMPLES |
Build API example programs. | OFF |
WITH_NDBCLUSTER |
NDB 8.0.30 and earlier: Build NDB storage engine. NDB 8.0.31 and later: Deprecated; use WITH_NDB instead | OFF |
WITH_NDBCLUSTER_STORAGE_ENGINE |
Prior to NDB 8.0.31, this was for internal use only. NDB 8.0.31 and later: toggles (only) inclusion of NDBCLUSTER storage engine | ON |
WITH_NDBMTD |
Build multithreaded data node binary | ON |
WITH_NDB_DEBUG |
Produce a debug build for testing or troubleshooting. | OFF |
WITH_NDB_JAVA |
Enable building of Java and ClusterJ support. Enabled by default. Supported in MySQL Cluster only. | ON |
WITH_NDB_PORT |
Default port used by a management server built with this option. If this option was not used to build it, the management server's default port is 1186. | [none] |
WITH_NDB_TEST |
Include NDB API test programs. | OFF |
WITH_NDB_TLS_SEARCH_PATH |
Default path used by NDB programs to search for TLS certificate and key files. | $HOME/ndb-tls |
WITH_NUMA |
Set NUMA memory allocation policy | |
WITH_PACKAGE_FLAGS |
For flags typically used for RPM/DEB packages, whether to add them to standalone builds on those platforms | |
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 |
WITH_ROUTER |
Whether to build MySQL Router | ON |
WITH_SASL |
Internal use only | |
WITH_SHOW_PARSE_TREE |
Support for SHOW PARSE_TREE debugging statement | |
WITH_SSL |
Type of SSL support | system |
WITH_SYSTEMD |
Enable installation of systemd support files | OFF |
WITH_SYSTEMD_DEBUG |
Enable additional systemd debug information | OFF |
WITH_SYSTEM_LIBS |
Set system value of library options not set explicitly | OFF |
WITH_TCMALLOC |
Whether to link with -ltcmalloc. BUNDLED is supported on Linux only | OFF |
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_WIN_JEMALLOC |
Path to directory containing jemalloc.dll | |
WITH_ZLIB |
Type of zlib support | bundled |
WITH_ZSTD |
Type of zstd support | bundled |
WITH_xxx_STORAGE_ENGINE |
Compile storage engine xxx statically into server |
General Options
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 the
build_id system variable
and written to the MySQL server log on startup. Set this
option to OFF 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_DEBUGoption is enabled. That is,-DWITH_DEBUG=1has the same effect as-DCMAKE_BUILD_TYPE=Debug.
The option values None and
MinSizeRel are not supported.
- -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.
- -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,
invoke CMake with
-DFORCE_INSOURCE_BUILD=ON.
- -DFORCE_COLORED_OUTPUT=bool
Defines whether to enable colorized compiler output for
gcc and clang when
compiling on the command line. Defaults to
OFF.
Installation Layout Options
The CMAKE_INSTALL_PREFIX option
indicates the base installation directory. Other options with
names of the form
INSTALL_xxx that
indicate component locations are interpreted relative to the
prefix and their values are relative pathnames. Their values
should not include the prefix.
The installation base directory.
This value can be set at server startup using the
--basedir option.
- -DINSTALL_BINDIR=dir_name
Where to install user programs.
- -DINSTALL_DOCDIR=dir_name
Where to install documentation.
- -DINSTALL_DOCREADMEDIR=dir_name
Where to install README files.
- -DINSTALL_INCLUDEDIR=dir_name
Where to install header files.
- -DINSTALL_INFODIR=dir_name
Where to install Info files.
- -DINSTALL_LAYOUT=name
Select a predefined installation layout:
STANDALONE: Same layout as used for.tar.gzand.zippackages. 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 the
secure_file_priv system
variable. See the description of this variable in
Section 7.1.8, “Server System Variables”.
- -DINSTALL_LIBDIR=dir_name
Where to install library files.
- -DINSTALL_MANDIR=dir_name
Where to install manual pages.
- -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 is
INSTALL_LIBDIR/pkgconfig, unless
INSTALL_LIBDIR ends with
/mysql, in which case that is removed
first.
- -DINSTALL_PLUGINDIR=dir_name
The location of the plugin directory.
This value can be set at server startup with the
--plugin_dir option.
- -DINSTALL_PRIV_LIBDIR=dir_name
The location of the dynamic library directory.
Default location.
For RPM builds, this is
/usr/lib64/mysql/private/, for DEB it
is /usr/lib/mysql/private/, and for
TAR it is lib/private/.
Protobuf.
Because this is a private location, the loader (such as
ld-linux.so on Linux) may not find
the libprotobuf.so files without
help. To guide the loader,
RPATH=$ORIGIN/../$INSTALL_PRIV_LIBDIR
is added to mysqld and
mysqlxtest. This works for most cases
but when using the
Resource Group
feature, mysqld is
setsuid, and the loader ignores any
RPATH which contains
$ORIGIN. To overcome this, an explicit
full path to the directory is set in the DEB and RPM
versions of mysqld, since the target
destination is known. For tarball installs, patching of
mysqld with a tool like
patchelf is required.
- -DINSTALL_SBINDIR=dir_name
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 the
INSTALL_LAYOUT
CMake option; see the description of the
secure_file_priv system
variable in Section 7.1.8, “Server System Variables”.
- -DINSTALL_SHAREDIR=dir_name
Where to install aclocal/mysql.m4.
- -DINSTALL_STATIC_LIBRARIES=bool
Whether to install static libraries. The default is
ON. If set to OFF,
these library files are not installed:
libmysqlclient.a,
libmysqlservices.a.
- -DINSTALL_SUPPORTFILESDIR=dir_name
Where to install extra support files.
- -DLINK_RANDOMIZE=bool
Whether to randomize the order of symbols in the
mysqld binary. The default is
OFF. This option should be enabled only
for debugging purp
(本文超出站点单文档体积上限,已截断)
