The CMake program provides a great deal of control over how you configure a MySQL source distribution. CMake程序提供了对如何配置MySQL源分发的大量控制。Typically, you do this using options on the CMake command line. 通常,可以使用CMake命令行上的选项来执行此操作。For information about options supported by CMake, run either of these commands in the top-level source directory:有关CMake支持的选项的信息,请在顶级源目录中运行以下任一命令:
cmake . -LH ccmake .
You can also affect CMake using certain environment variables. See Section 4.9, “Environment Variables”.也可以使用某些环境变量影响CMake。参见第4.9节,“环境变量”。
For boolean options, the value may be specified as 1 or 对于布尔选项,该值可以指定为1或ON
to enable the option, or as 0 or OFF
to disable the option.ON
以启用该选项,也可以指定为0或OFF
以禁用该选项。
Many options configure compile-time defaults that can be overridden at server startup. 许多选项配置可在服务器启动时重写的编译时默认值。For example, the 例如,配置默认安装基本目录位置、TCP/IP端口号和UNIX套接字文件的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. CMAKE_INSTALL_PREFIX
、MYSQL_TCP_PORT
和MYSQL_UNIX_ADDR
选项可以在服务器启动时使用mysqld的--basedir
、--port
和--socket
选项进行更改。Where applicable, configuration option descriptions indicate the corresponding mysqld startup option.在适用的情况下,配置选项描述指示相应的mysqld启动选项。
The following sections provide more information about CMake options.以下部分提供了有关CMake选项的更多信息。
The following table shows the available CMake options. 下表显示了可用的CMake选项。In the 在Default
column, PREFIX
stands for the value of the CMAKE_INSTALL_PREFIX
option, which specifies the installation base directory. Default
列中,PREFIX
代表CMAKE_INSTALL_PREFIX
选项的值,该选项指定安装基本目录。This value is used as the parent location for several of the installation subdirectories.此值用作几个安装子目录的父位置。
Table 2.14 MySQL Source-Configuration Option Reference (CMake)表2.14 MySQL源配置选项参考(CMake)
ADD_GDB_INDEX | 8.0.18 | |||
---|---|---|---|---|
BUILD_CONFIG | ||||
BUNDLE_RUNTIME_LIBRARIES | OFF | |||
CMAKE_BUILD_TYPE | RelWithDebInfo | |||
CMAKE_CXX_FLAGS | ||||
CMAKE_C_FLAGS | ||||
CMAKE_INSTALL_PREFIX | /usr/local/mysql | |||
COMPILATION_COMMENT | ||||
COMPILATION_COMMENT_SERVER | 8.0.14 | |||
COMPRESS_DEBUG_SECTIONS | OFF | 8.0.22 | ||
CPACK_MONOLITHIC_INSTALL | OFF | |||
DEFAULT_CHARSET | utf8mb4 | |||
DEFAULT_COLLATION | utf8mb4_0900_ai_ci | |||
DISABLE_PSI_COND | OFF | |||
DISABLE_PSI_DATA_LOCK | OFF | |||
DISABLE_PSI_ERROR | OFF | |||
DISABLE_PSI_FILE | OFF | |||
DISABLE_PSI_IDLE | OFF | |||
DISABLE_PSI_MEMORY | OFF | |||
DISABLE_PSI_METADATA | OFF | |||
DISABLE_PSI_MUTEX | OFF | |||
DISABLE_PSI_PS | OFF | |||
DISABLE_PSI_RWLOCK | OFF | |||
DISABLE_PSI_SOCKET | OFF | |||
DISABLE_PSI_SP | OFF | |||
DISABLE_PSI_STAGE | OFF | |||
DISABLE_PSI_STATEMENT | OFF | |||
DISABLE_PSI_STATEMENT_DIGEST | OFF | |||
DISABLE_PSI_TABLE | OFF | |||
DISABLE_PSI_THREAD | OFF | |||
DISABLE_PSI_TRANSACTION | OFF | |||
DISABLE_SHARED | OFF | 8.0.18 | ||
DOWNLOAD_BOOST | OFF | |||
DOWNLOAD_BOOST_TIMEOUT | 600 | |||
ENABLED_LOCAL_INFILE | OFF | |||
ENABLED_PROFILING | ON | |||
ENABLE_DOWNLOADS | OFF | 8.0.26 | ||
ENABLE_EXPERIMENTAL_SYSVARS | InnoDB 系统变量 | OFF | ||
ENABLE_GCOV | ||||
ENABLE_GPROF | OFF | |||
FORCE_INSOURCE_BUILD | OFF | 8.0.14 | ||
FORCE_UNSUPPORTED_COMPILER | OFF | |||
FPROFILE_GENERATE | OFF | 8.0.19 | ||
FPROFILE_USE | OFF | 8.0.19 | ||
HAVE_PSI_MEMORY_INTERFACE | OFF | 8.0.26 | ||
IGNORE_AIO_CHECK | OFF | |||
INSTALL_BINDIR | PREFIX/bin | |||
INSTALL_DOCDIR | PREFIX/docs | |||
INSTALL_DOCREADMEDIR | PREFIX | |||
INSTALL_INCLUDEDIR | PREFIX/include | |||
INSTALL_INFODIR | PREFIX/docs | |||
INSTALL_LAYOUT | STANDALONE | |||
INSTALL_LIBDIR | PREFIX/lib | |||
INSTALL_MANDIR | PREFIX/man | |||
INSTALL_MYSQLKEYRINGDIR | platform specific | |||
INSTALL_MYSQLSHAREDIR | PREFIX/share | |||
INSTALL_MYSQLTESTDIR | mysql-test | PREFIX/mysql-test | ||
INSTALL_PKGCONFIGDIR | INSTALL_LIBDIR/pkgconfig | |||
INSTALL_PLUGINDIR | PREFIX/lib/plugin | |||
INSTALL_PRIV_LIBDIR | 8.0.18 | |||
INSTALL_SBINDIR | PREFIX/bin | |||
INSTALL_SECURE_FILE_PRIVDIR | secure_file_priv | platform specific | ||
INSTALL_SHAREDIR | aclocal/mysql.m4 | PREFIX/share | ||
INSTALL_STATIC_LIBRARIES | ON | |||
INSTALL_SUPPORTFILESDIR | PREFIX/support-files | |||
LINK_RANDOMIZE | OFF | |||
LINK_RANDOMIZE_SEED | mysql | |||
MAX_INDEXES | 64 | |||
MUTEX_TYPE | InnoDB | event | ||
MYSQLX_TCP_PORT | 33060 | |||
MYSQLX_UNIX_ADDR | /tmp/mysqlx.sock | |||
MYSQL_DATADIR | ||||
MYSQL_MAINTAINER_MODE | OFF | |||
MYSQL_PROJECT_NAME | MySQL | |||
MYSQL_TCP_PORT | 3306 | |||
MYSQL_UNIX_ADDR | /tmp/mysql.sock | |||
NDB_UTILS_LINK_DYNAMIC | 8.0.22-ndb-8.0.22 | |||
ODBC_INCLUDES | ||||
ODBC_LIB_DIR | ||||
OPTIMIZER_TRACE | ||||
REPRODUCIBLE_BUILD | ||||
SYSCONFDIR | ||||
SYSTEMD_PID_DIR | /var/run/mysqld | |||
SYSTEMD_SERVICE_NAME | mysqld | |||
TMPDIR | ||||
USE_LD_GOLD | ON | |||
USE_LD_LLD | ON | 8.0.16 | ||
WIN_DEBUG_NO_INLINE | OFF | |||
WITHOUT_xxx_STORAGE_ENGINE | ||||
WITH_ANT | ||||
WITH_ASAN | OFF | |||
WITH_ASAN_SCOPE | OFF | |||
WITH_AUTHENTICATION_CLIENT_PLUGINS | 8.0.26 | |||
WITH_AUTHENTICATION_LDAP | OFF | |||
WITH_AUTHENTICATION_PAM | OFF | |||
WITH_AWS_SDK | ||||
WITH_BOOST | ||||
WITH_CLIENT_PROTOCOL_TRACING | ON | |||
WITH_CURL | ||||
WITH_DEBUG | OFF | |||
WITH_DEFAULT_COMPILER_OPTIONS | ON | |||
WITH_DEFAULT_FEATURE_SET | ON | 8.0.22 | ||
WITH_EDITLINE | bundled | |||
WITH_GMOCK | 8.0.26 | |||
WITH_ICU | bundled | |||
WITH_INNODB_EXTRA_DEBUG | InnoDB 的额外调试支持。 | OFF | ||
WITH_INNODB_MEMCACHED | OFF | |||
WITH_JEMALLOC | OFF | 8.0.16 | ||
WITH_KEYRING_TEST | OFF | |||
WITH_LIBEVENT | bundled | |||
WITH_LIBWRAP | OFF | |||
WITH_LOCK_ORDER | OFF | 8.0.17 | ||
WITH_LSAN | OFF | 8.0.16 | ||
WITH_LTO | OFF | 8.0.13 | ||
WITH_LZ4 | bundled | |||
WITH_LZMA | bundled | 8.0.16 | ||
WITH_MECAB | ||||
WITH_MSAN | OFF | |||
WITH_MSCRT_DEBUG | OFF | |||
WITH_MYSQLX | ON | |||
WITH_NUMA | ||||
WITH_PACKAGE_FLAGS | 8.0.26 | |||
WITH_PROTOBUF | bundled | |||
WITH_RAPID | ON | |||
WITH_RAPIDJSON | bundled | 8.0.13 | ||
WITH_RE2 | bundled | 8.0.18 | ||
WITH_ROUTER | ON | 8.0.16 | ||
WITH_SSL | system | |||
WITH_SYSTEMD | OFF | |||
WITH_SYSTEMD_DEBUG | OFF | 8.0.22 | ||
WITH_SYSTEM_LIBS | OFF | |||
WITH_TCMALLOC | OFF | 8.0.22 | ||
WITH_TEST_TRACE_PLUGIN | OFF | |||
WITH_TSAN | OFF | |||
WITH_UBSAN | OFF | |||
WITH_UNIT_TESTS | ON | |||
WITH_UNIXODBC | OFF | |||
WITH_VALGRIND | OFF | |||
WITH_ZLIB | bundled | |||
WITH_ZSTD | bundled | 8.0.18 | ||
WITH_xxx_STORAGE_ENGINE |
This option configures a source distribution with the same build options used by Oracle to produce binary distributions for official MySQL releases.此选项使用Oracle用于为正式MySQL版本生成二进制发行版的相同构建选项配置源发行版。
-DBUNDLE_RUNTIME_LIBRARIES=
bool
Whether to bundle runtime libraries with server MSI and Zip packages for Windows.是否将运行库与适用于Windows的服务器MSI和Zip包捆绑在一起。
The type of build to produce:要生成的生成类型:
RelWithDebInfo
: Enable optimizations and generate debugging information. This is the default MySQL build type.:启用优化并生成调试信息。这是默认的MySQL构建类型。
Release
: Enable optimizations but omit debugging information to reduce the build size. This build type was added in MySQL 8.0.13.:启用优化,但省略调试信息以减小生成大小。此构建类型是在MySQL 8.0.13中添加的。
Debug
: Disable optimizations and generate debugging information. :禁用优化并生成调试信息。This build type is also used if the 如果启用了WITH_DEBUG
option is enabled. WITH_DEBUG
选项,也会使用此生成类型。That is, 也就是说,-DWITH_DEBUG=1
has the same effect as -DCMAKE_BUILD_TYPE=Debug
.-DWITH_DEBUG=1
与-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. 此选项影响make package操作是生成多个安装包文件还是生成单个文件。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.如果禁用,该操作将生成多个安装包文件,如果您只想安装完整MySQL安装的一个子集,则这可能很有用。如果启用,它将生成用于安装所有内容的单个文件。
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调用CMake。-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. xxx
CMAKE_INSTALL_PREFIX
选项指示基本安装目录。其他名称形式为INSTALL_xxx
的选项表示组件位置,这些选项相对于前缀进行解释,其值为相对路径名。Their values should not include the prefix.它们的值不应包括前缀。
-DCMAKE_INSTALL_PREFIX=
dir_name
The installation base directory.安装基本目录。
This value can be set at server startup with the 该值可以在服务器启动时使用--basedir
option.--basedir
选项进行设置。
Where to install user programs.在何处安装用户程序。
Where to install documentation.在何处安装文档。
-DINSTALL_DOCREADMEDIR=
dir_name
Where to install README
files.READM
E文件的安装位置。
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..tar.gz
和.zip
包的布局相同。这是默认设置。
RPM
: Layout similar to RPM packages.:布局类似于RPM软件包。
SVR4
: Solaris package layout.:Solaris程序包布局。
DEB
: DEB package layout (experimental).:DEB包布局(实验)。
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
, keyring_encrypted_file_data
, and keyring_file_data
system variables. See the descriptions of those variables in Section 5.1.8, “Server System Variables”, and Section 6.4.4.18, “Keyring System Variables”.INSTALL_LAYOUT
值确定secure_file_priv
、keyring_encrypted_file_data
和keyring_file_data
系统变量的默认值。请参阅第5.1.8节,“服务器系统变量”和第6.4.4.18节,“密钥系统变量”中对这些变量的描述。
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. keyring_file
插件数据文件位置的默认目录。The default value is platform specific and depends on the value of the 默认值是特定于平台的,取决于INSTALL_LAYOUT
CMake option; see the description of the keyring_file_data
system variable in Section 5.1.8, “Server System Variables”.INSTALL_LAYOUT
CMake选项的值;请参阅第5.1.8节,“服务器系统变量”中对keyring_file_data
系统变量的描述。
-DINSTALL_MYSQLSHAREDIR=
dir_name
Where to install shared data files.在何处安装共享数据文件。
-DINSTALL_MYSQLTESTDIR=
dir_name
Where to install the mysql-test
directory. mysql-test
目录的安装位置。To suppress installation of this directory, explicitly set the option to the empty value (要禁止安装此目录,请显式地将该选项设置为空值(-DINSTALL_MYSQLTESTDIR=
).-DISTALL_MYSQLTESTDIR=
)。
-DINSTALL_PKGCONFIGDIR=
dir_name
The directory in which to install the 在其中安装mysqlclient.pc
file for use by pkg-config. mysqlclient.pc
文件以供pkg-config使用的目录。The default value is 默认值为INSTALL_LIBDIR/pkgconfig
, unless INSTALL_LIBDIR
ends with /mysql
, in which case that is removed first.INSTALL_LIBDIR/pkgconfig
,除非INSTALL_LIBRDIR
以/mysql
结尾,在这种情况下,它将首先被删除。
The location of the plugin directory.插件目录的位置。
This value can be set at server startup with the 这个值可以在服务器启动时使用--plugin_dir
option.--plugin_dir
选项进行设置。
-DINSTALL_PRIV_LIBDIR=
dir_name
The location of the dynamic library directory.动态库目录的位置。
Default locations: 默认位置:RPM = /usr/lib64/mysql/private/
, DEB = /usr/lib/mysql/private/
, and TAR = lib/private/
.
This option was added in MySQL 8.0.18.此选项是在MySQL 8.0.18中添加的。
For Protobuf: Because this is a private location, loader (such as ld-linux.so on Linux) may not find the 对于Protobuf:因为这是一个私有位置,加载程序(如Linux上的ld linuxso)在没有帮助的情况下可能找不到libprotobuf.so
files without help. libprotobuf.so
文件。To guide loader, 为了引导加载程序,RPATH
with value $ORIGIN/../$INSTALL_PRIV_LIBDIR is added to mysqld and mysqlxtest. RPATH
的值为$ORIGIN/../$INSTALL_PRIV_LIBDIR被添加到mysqld和mysqlxtest中。This works for most cases but when using the Resource Group feature, mysqld is setsuid and then loader ignores 这适用于大多数情况,但当使用资源组功能时,mysqld是setuid,然后loader会忽略包含RPATH
which contains $ORIGIN
. $ORIGIN
的RPATH
。To overcome this, an explicit full path to the directory is set in DEB and RPM variants of mysqld, as the target destination is known. 为了克服这个问题,在mysqld的DEB和RPM变体中设置了一个指向目录的显式完整路径,因为目标目的地是已知的。For tarball installs, patching of mysqld with a tool like patchelf is required.对于tarball安装,需要使用patchelf等工具对mysqld进行修补。
Where to install the mysqld server.mysqld服务器的安装位置。
-DINSTALL_SECURE_FILE_PRIVDIR=
dir_name
The default value for the secure_file_priv
system variable. secure_file_priv
系统变量的默认值。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 5.1.8, “Server System Variables”.INSTALL_LAYOUT
CMake选项的值;请参阅第5.1.8节,“服务器系统变量”中对secure_file_priv
系统变量的描述。
Where to install 在何处安装aclocal/mysql.m4
.aclocal/mysql.m4
。
-DINSTALL_STATIC_LIBRARIES=
bool
Whether to install static libraries. 是否安装静态库。The default is 默认值为ON
. ON
。If set to 如果设置为OFF
, these libraries are not installed: libmysqlclient.a
, libmysqlservices.a
.OFF
,则不会安装以下库: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. 是否随机化mysqld二进制文件中的符号顺序。The default is 默认值为OFF
. This option should be enabled only for debugging purposes.OFF
。此选项应仅用于调试目的。
Seed value for the LINK_RANDOMIZE
option. LINK_RANDOMIZE
选项的种子值。The value is a string. The default is 值是一个字符串。默认值是mysql
, an arbitrary choice.mysql
,这是一个任意选择。
The location of the MySQL data directory.MySQL数据目录的位置。
This value can be set at server startup with the 该值可以在服务器启动时使用--datadir
option.--datadir
选项进行设置。
The location of the ODBC includes directory, and may be used while configuring Connector/ODBC.ODBC的位置包括目录,并且可以在配置连接器/ODBC时使用。
The location of the ODBC library directory, and may be used while configuring Connector/ODBC.ODBC库目录的位置,并且可以在配置连接器/ODBC时使用。
The default 默认的my.cnf
option file directory.my.cnf
选项文件目录。
This location cannot be set at server startup, but you can start the server with a given option file using the 无法在服务器启动时设置此位置,但可以使用--defaults-file=
option, where file_name
file_name
is the full path name to the file.--defaults-file=file_name
选项使用给定的选项文件启动服务器,其中file_name
是文件的完整路径名。
The name of the directory in which to create the PID file when MySQL is managed by systemd. 当MySQL由systemd管理时,要在其中创建PID文件的目录的名称。The default is 默认值为/var/run/mysqld
; this might be changed implicitly according to the INSTALL_LAYOUT
value./var/run/mysqld
;这可能会根据INSTALL_LAYOUT
值隐式地进行更改。
This option is ignored unless 除非启用了WITH_SYSTEMD
is enabled.WITH_SYSTEMD
,否则会忽略此选项。
The name of the MySQL service to use when MySQL is managed by systemd. 当MySQL由systemd管理时要使用的MySQL服务的名称。The default is 默认为mysqld
; this might be changed implicitly according to the INSTALL_LAYOUT
value.mysqld
;这可能会根据INSTALL_LAYOUT
值隐式地进行更改。
This option is ignored unless 除非启用了WITH_SYSTEMD
is enabled.WITH_SYSTEMD
,否则会忽略此选项。
The default location to use for the 用于tmpdir
system variable. tmpdir
系统变量的默认位置。If unspecified, the value defaults to 如果未指定,则该值默认为P_tmpdir
in <stdio.h>
.<stdio.h>
中的P_tmpdir
。
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). INSTALL PLUGIN
语句或--plugin-load
选项将其安装到服务器中才能使用)。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.InnoDB
、MyISAM
、MERGE
、MEMORY
和CSV
引擎是强制性的(总是编译到服务器中),不需要显式安装。
To compile a storage engine statically into the server, use 要将存储引擎静态编译到服务器中,请使用-DWITH_
. engine
_STORAGE_ENGINE=1-DWITH_engine_STORAGE_ENGINE=1
。Some permissible 一些允许的engine
values are ARCHIVE
, BLACKHOLE
, EXAMPLE
, FEDERATED
, and NDB
or NDBCLUSTER
(NDB
support). engine
值为ARCHIVE
、BLACKHOLE
、EXAMPLE
、FEDERATED
和NDB
或NDBCLUSTER
(NDB
支持)。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:如果没有性能架构支持,就无法进行编译。如果希望在没有特定类型的插入的情况下进行编译,可以使用以下CMake选项来完成:
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.-DDISABLE_PSI_MUTEX=1
选项配置MySQL。
To exclude a storage engine from the build, use 要从生成中排除存储引擎,请使用-DWITH_
. Examples:engine
_STORAGE_ENGINE=0-DWITH_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
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 than lld or GNU gold is used.
This option was added in MySQL 8.0.18.
A descriptive comment about the compilation environment. As of MySQL 8.0.14, mysqld uses COMPILATION_COMMENT_SERVER
. Other programs continue to use COMPILATION_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.是否压缩二进制可执行文件的调试部分(仅限Linux)。压缩可执行调试部分可以节省空间,但在构建过程中需要额外的CPU时间。
The default is OFF
. If this option is not set explicitly but the COMPRESS_DEBUG_SECTIONS
environment variable is set, the option takes its value from that variable.
This option was added in MySQL 8.0.22.此选项是在MySQL 8.0.22中添加的。
-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 uses COMPILATION_COMMENT
.
-DDEFAULT_CHARSET=
charset_name
The server character set. By default, MySQL uses the utf8mb4
character set.
charset_name
may be one of binary
, armscii8
, ascii
, big5
, cp1250
, cp1251
, cp1256
, cp1257
, cp850
, cp852
, cp866
, cp932
, dec8
, eucjpms
, euckr
, gb2312
, gbk
, geostd8
, greek
, hebrew
, hp8
, keybcs2
, koi8r
, koi8u
, latin1
, latin2
, latin5
, latin7
, macce
, macroman
, sjis
, swe7
, tis620
, ucs2
, ujis
, utf8
, utf8mb4
, utf16
, utf16le
, utf32
. The permissible character sets are listed in the cmake/character_sets.cmake
file as the value of CHARSETS_AVAILABLE
.
This value can be set at server startup with the 该值可以在服务器启动时使用--character_set_server
option.--character_set_server
选项进行设置。
-DDEFAULT_COLLATION=
collation_name
The server collation. By default, MySQL uses utf8mb4_0900_ai_ci
. Use the SHOW COLLATION
statement to determine which collations are available for each character set.
This value can be set at server startup with the 该值可以在服务器启动时使用--collation_server
option.--collination_server
选项进行设置。
Whether to exclude the Performance Schema condition instrumentation. The default is 是否排除性能架构条件检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema file instrumentation. The default is 是否排除性能架构文件检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema idle instrumentation. The default is 是否排除性能架构空闲检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema memory instrumentation. The default is 是否排除性能架构内存检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema metadata instrumentation. The default is 是否排除性能架构元数据检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema mutex instrumentation. The default is 是否排除性能架构互斥检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema rwlock instrumentation. The default is 是否排除性能架构rwlock检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema socket instrumentation. The default is 是否排除性能架构套接字检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema stored program instrumentation. The default is 是否排除性能架构存储程序检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema stage instrumentation. The default is 是否排除性能架构阶段检测。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema statement instrumentation. The default is 是否排除性能架构语句检测。默认值为OFF
(include).OFF
(包括)。
-DDISABLE_PSI_STATEMENT_DIGEST=
bool
Whether to exclude the Performance Schema statement_digest instrumentation. The default is 是否排除性能架构statement_dgest指令插入。默认值为OFF
(include).OFF
(包括)。
Whether to exclude the Performance Schema table instrumentation. The default is 是否排除性能架构表检测。默认值为OFF
(include).OFF
(包括)。
Whether to disable building build shared libraries and compile position-dependent code. The default is 是否禁用生成共享库和编译位置相关代码。默认值为OFF
(compile position-independent code).OFF
(编译位置无关代码)。
This option is unused and was removed in MySQL 8.0.18.此选项未使用,已在MySQL 8.0.18中删除。
Exclude the performance schema prepared statements instances instrumentation. The default is 排除性能架构准备的语句实例检测。默认值为OFF
(include).OFF
(包括)。
Exclude the performance schema thread instrumentation. The default is 排除性能架构线程检测。默认值为OFF
(include).OFF
(包括)。
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).OFF
(包括)。
Exclude the performance schema data lock instrumentation. The default is 排除性能架构数据锁定检测。默认值为OFF
(include).OFF
(包括)。
Exclude the performance schema server error instrumentation. The default is 排除性能架构服务器错误检测。默认值为OFF
(include).OFF
(包括)。
Whether to download the Boost library. The default is 是否下载Boost库。默认值为OFF
.OFF
。
See the 有关使用BOOST的更多讨论,请参阅WITH_BOOST
option for additional discussion about using Boost.WITH_BOOST
选项。
-DDOWNLOAD_BOOST_TIMEOUT=
seconds
The timeout in seconds for downloading the Boost library. The default is 600 seconds.下载Boost库的超时时间(以秒为单位)。默认值为600秒。
See the 有关使用BOOST的更多讨论,请参阅WITH_BOOST
option for additional discussion about using Boost.WITH_BOOST
选项。
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.是否下载可选文件。例如,启用此选项后,CMake将下载测试套件用于运行单元测试的Google Test分发版,或者下载构建GCS Java包装器所需的Ant和JUnit。
As of MySQL 8.0.26, MySQL source distributions bundle the Google Test source code, used to run Google Test-based unit tests. 从MySQL 8.0.26开始,MySQL源发行版捆绑了Google Test源代码,用于运行基于Google Test的单元测试。Consequently, as of that version the WITH_GMOCK
and ENABLE_DOWNLOADS
CMake options are removed and are ignored if specified.
-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).是否包括gcov支持(仅限Linux)。
Whether to enable gprof
(optimized Linux builds only).
This option controls the compiled-in default LOCAL
capability for the MySQL client library. Clients that make no explicit arrangements therefore have LOCAL
capability disabled or enabled according to the ENABLED_LOCAL_INFILE
setting specified at MySQL build time.
By default, the client library in MySQL binary distributions is compiled with ENABLED_LOCAL_INFILE
disabled. If you compile MySQL from source, configure it with ENABLED_LOCAL_INFILE
disabled or enabled based on whether clients that make no explicit arrangements should have LOCAL
capability disabled or enabled, respectively.
ENABLED_LOCAL_INFILE
controls the default for client-side LOCAL
capability. For the server, the local_infile
system variable controls server-side LOCAL
capability. To explicitly cause the server to refuse or permit LOAD DATA LOCAL
statements (regardless of how client programs and libraries are configured at build time or runtime), start mysqld with local_infile
disabled or enabled, respectively. local_infile
can also be set at runtime. See Section 6.1.6, “Security Considerations for LOAD DATA LOCAL”.
Whether to enable query profiling code (for the SHOW PROFILE
and SHOW PROFILES
statements).
-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
.
Whether to generate profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. See the cmake/fprofile.cmake
file in a MySQL source distribution for information about using FPROFILE_GENERATE
and FPROFILE_USE
. These options have been tested with GCC 8 and 9.
This option was added in MySQL 8.0.19.此选项是在MySQL 8.0.19中添加的。
Whether to use profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. See the cmake/fprofile.cmake
file in a MySQL source distribution for information about using FPROFILE_GENERATE
and FPROFILE_USE
. These options have been tested with GCC 8 and 9.
Enabling FPROFILE_USE
also enables WITH_LTO
.
This option was added in MySQL 8.0.19.此选项是在MySQL 8.0.19中添加的。
-DHAVE_PSI_MEMORY_INTERFACE=
bool
Whether to enable the performance schema memory tracing module for memory allocation functions (是否为过对齐类型的动态存储中使用的内存分配函数(ut::aligned_
library functions) used in dynamic storage of over-aligned types.name
ut::aligned_name
库函数)启用性能模式内存跟踪模块。
If the -DBUILD_CONFIG=mysql_release
option is given on Linux, the libaio
library must be linked in by default. If you do not have libaio
or do not want to install it, you can suppress the check for it by specifying -DIGNORE_AIO_CHECK=1
.
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.每个表的最大索引数。默认值为64。最大值为255。将忽略小于64的值,并使用默认值64。
Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors.是否启用MySQL维护者特定的开发环境。如果启用,此选项会导致编译器警告变为错误。
The mutex type used by InnoDB
. Options include:InnoDB
使用的互斥对象类型。选项包括:
event
: Use event mutexes. This is the default value and the original InnoDB
mutex implementation.
sys
: Use POSIX mutexes on UNIX systems. Use CRITICAL_SECTION
onjects on Windows, if available.
futex
: Use Linux futexes instead of condition variables to schedule waiting threads.:使用Linux futex而不是条件变量来调度等待线程。
The port number on which X Plugin listens for TCP/IP connections. The default is 33060.X插件侦听TCP/IP连接的端口号。默认值为33060。
This value can be set at server startup with the 此值可以在服务器启动时使用mysqlx_port
system variable.mysqlx_port
系统变量进行设置。
The Unix socket file path on which the server listens for X Plugin socket connections. Unix套接字文件路径,服务器在该路径上侦听X插件套接字连接。This must be an absolute path name. 这必须是一个绝对路径名。The default is 默认值为/tmp/mysqlx.sock
./tmp/mysqlx.sock
。
This value can be set at server startup with the 此值可以在服务器启动时使用mysqlx_port
system variable.mysqlx_port
系统变量进行设置。
For Windows or macOS, the project name to incorporate into the project file name.对于Windows或macOS,要合并到项目文件名中的项目名称。
The port number on which the server listens for TCP/IP connections. The default is 3306.服务器侦听TCP/IP连接的端口号。默认值为3306。
This value can be set at server startup with the 此值可以在服务器启动时使用--port
option.--port
选项进行设置。
The Unix socket file path on which the server listens for socket connections. This must be an absolute path name. Unix套接字文件路径,服务器在该路径上侦听套接字连接。这必须是一个绝对路径名。The default is 默认值为/tmp/mysql.sock
./tmp/mysql.sock
。
This value can be set at server startup with the 这个值可以在服务器启动时使用--socket
option.--socket
选项进行设置。
Whether to support optimizer tracing. See MySQL Internals: Tracing the Optimizer.是否支持优化器跟踪。请参阅MySQL内部:跟踪优化器。
For builds on Linux systems, this option controls whether to take extra care to create a build result independent of build location and time.对于Linux系统上的构建,此选项控制是否要格外小心地创建独立于构建位置和时间的构建结果。
This option was added in MySQL 8.0.11. As of MySQL 8.0.12, it defaults to 此选项是在MySQL 8.0.11中添加的。从MySQL 8.0.12开始,对于ON
for RelWithDebInfo
builds.RelWithDebInfo
构建,它默认为ON
。
CMake causes the build process to link with the GNU gold linker if it is available and not explicitly disabled. 如果GNU黄金链接器可用且未明确禁用,CMake会使构建过程与之链接。To disable use of this linker, specify the 要禁用此链接器,请指定-DUSE_LD_GOLD=OFF
option.-DUSE_LD_GOLD=OFF
选项。
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.此选项是在MySQL 8.0.16中添加的。
Whether to disable function inlining on Windows. The default is off (inlining enabled).是否在Windows上禁用函数内联。默认为关闭(启用内联)。
Set the path to Ant, required when building GCS Java wrapper. 将路径设置为Ant,这在构建GCS Java包装器时是必需的。Works in a similar way to the existing WITH_BOOST
CMake option. Set WITH_ANT
to the path of a directory where the Ant tarball, or an already unpacked archive, is saved. When WITH_ANT
is not set, or is set with the special value system
, the build assumes a binary ant exists in $PATH
.
Whether to enable the AddressSanitizer, for compilers that support it. The default is off.对于支持AddressSanitizer的编译器,是否启用它。默认为关闭。
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 other CMake options and it should not be set explicitly.如果构建了任何相应的服务器身份验证插件,则会自动启用此选项。因此,它的值取决于其他CMake选项,不应显式设置。
This option was added in MySQL 8.0.26.
-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. 是否为包含此插件的源树构建PAM身份验证插件。(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 the path_name
BOOST_ROOT
or WITH_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 is bool
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 例如,如果你通常构建MySQL,将对象输出放在MySQL源树的bld
subdirectory of your MySQL source tree, you can build with Boost like this:bld
子目录中,你可以像这样使用Boost构建:
mkdir bld cd bld cmake .. -DDOWNLOAD_BOOST=ON -DWITH_BOOST=$HOME/my_boost
This causes Boost to be downloaded into the 这将导致Boost被下载到主目录下的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.my_boost
目录中。如果所需的Boost版本已经存在,则不进行下载。如果所需的Boost版本发生更改,则会下载新版本。
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. 如果Boost已经在本地安装,并且编译器自己找到Boost头文件,则可能不需要指定前面的CMake选项。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.但是,如果MySQL所需的Boost版本发生了变化,并且本地安装的版本没有升级,则可能会出现构建问题。使用CMake选项应该会给您一个成功的构建。
With the above settings that allow Boost download into a specified location, when the required Boost version changes, you need to remove the 使用上述允许Boost下载到指定位置的设置,当所需的Boost版本发生变化时,您需要删除bld
folder, recreate it, and perform the cmake step again. Otherwise, the new Boost version might not get downloaded, and compilation might fail.bld
文件夹,重新创建它,然后再次执行cmake步骤。否则,新的Boost版本可能无法下载,编译可能会失败。
-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 Writing Protocol Trace Plugins.有关编写协议跟踪客户端插件的信息,请参阅编写协议跟踪插件。
See also the WITH_TEST_TRACE_PLUGIN
option.
The location of the curl library. curl_type
can be system
(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 under UNIV_DEBUG
and is available when debugging support is compiled in using the WITH_DEBUG
option. When debugging support is compiled in, the innodb_sync_debug
configuration option can be used to enable or disable InnoDB
sync debug checking.
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, where N
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 the WITH_DEBUG
option.WITH_DEBUG
选项编译调试支持时,可以对InnoDB
存储引擎进行同步调试检查。
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
. This option was removed in MySQL 8.0.22.
Which libedit
/editline
library to use. The permitted values are bundled
(the default) and system
.
The path to the googlemock distribution, for use with Google Test-based unit tests. The option value is the path to the distribution Zip file. Alternatively, set the WITH_GMOCK
environment variable to the path name. It is also possible to use -DENABLE_DOWNLOADS=1
, so that CMake downloads the distribution from GitHub.
If you build MySQL without the Google Test-based unit tests (by configuring wihout WITH_GMOCK
), CMake displays a message indicating how to download it.
As of MySQL 8.0.26, MySQL source distributions bundle the Google Test source code, used to run Google Test-based unit tests. Consequently, as of that version the WITH_GMOCK
and ENABLE_DOWNLOADS
CMake options are removed and are ignored if specified.
-DWITH_ICU={
icu_type
|path_name
}
MySQL uses International Components for Unicode (ICU) to support regular expression operations. The MySQL使用International Components for Unicode(ICU)来支持正则表达式操作。WITH_ICU
option indicates the type of ICU support to include or the path name to the ICU installation to use.WITH_ICU
选项指示要包括的ICU支持类型或要使用的ICU安装的路径名。
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.:使用与分发捆绑在一起的ICU库。这是默认选项,也是Windows唯一支持的选项。
system
: Use the system ICU library.:使用系统ICU库。
path_name
is the path name to the ICU installation to use. This can be preferable to using the icu_type
value of system
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 set WITH_ICU
to system
and set the CMAKE_PREFIX_PATH
option to path_name
.)
-DWITH_INNODB_EXTRA_DEBUG=
bool
Whether to include extra InnoDB debugging support.是否包括额外的InnoDB
调试支持。
Enabling WITH_INNODB_EXTRA_DEBUG
turns on extra InnoDB debug checks. This option can only be enabled when WITH_DEBUG
is enabled.
Whether to generate memcached shared libraries (libmemcached.so
and innodb_engine.so
).
Whether to link with -ljemalloc
. If enabled, built-in malloc()
, calloc()
, realloc()
, and free()
routines are disabled. The default is OFF
.
WITH_JEMALLOC
and WITH_TCMALLOC
are mutually exclusive.
This option was added in MySQL 8.0.16.
Whether to build the test program that accompanies the keyring_file
plugin. The default is OFF
. Test file source code is located in the plugin/keyring/keyring-test
directory.
Which libevent
library to use. Permitted values are bundled
(default) and system
. Prior to MySQL 8.0.21, if you specify system
, the system libevent
library is used if present, and an error occurs otherwise. In MySQL 8.0.21 and later, if system
is specified and no system libevent
library can be found, an error occurs regardless, and the bundled libevent
is not used.
The libevent
library is required by InnoDB
memcached, X Plugin, and MySQL Router.
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 5.9.3, “The LOCK_ORDER Tool”.是否启用LOCK_ORDER工具。默认情况下,此选项处于禁用状态,并且服务器构建不包含任何工具。如果启用了工具,则LOCK_ORDER工具可用,并且可以按照第5.9.3节,“LOCK_ORDER工具”中的说明使用。
With the 启用WITH_LOCK_ORDER
option enabled, MySQL builds require the flex program.WITH_LOCK_ORDER
选项后,MySQL构建需要flex
程序。
This option was added in MySQL 8.0.17.
Whether to run LeakSanitizer, without AddressSanitizer. The default is 是否在没有AddressSanitizer的情况下运行LeakSanitizer。默认值为OFF
.OFF
。
This option was added in MySQL 8.0.16.此选项是在MySQL 8.0.16中添加的。
Whether to enable the link-time optimizer, if the compiler supports it. The default is OFF
unless FPROFILE_USE
is enabled.
This option was added in MySQL 8.0.13.此选项是在MySQL 8.0.13中添加的。
The WITH_LZ4
indicates the source of zlib
support:
bundled
: Use the :使用与发行版捆绑的lz4
library bundled with the distribution. This is the default.lz4
库。这是默认设置。
system
: Use the system lz4
library. If WITH_LZ4
is set to this value, the lz4_decompress utility is not built. In this case, the system lz4 command can be used instead.
The type of LZMA library support to include. LZMA库支持的类型包括在内。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.此选项已在MySQL 8.0.16中删除。
-DWITH_MECAB={disabled|system|
path_name
}
Use this option to compile the MeCab parser. If you have installed MeCab to its default installation directory, set -DWITH_MECAB=system
. The system
option applies to MeCab installations performed from source or from binaries using a native package management utility. If you installed MeCab to a custom installation directory, specify the path to the MeCab installation. For example, -DWITH_MECAB=/opt/mecab
. If the system
option does not work, specifying the MeCab installation path should work in all cases.
For related information, see Section 12.10.9, “MeCab Full-Text Parser Plugin”.
Whether to enable MemorySanitizer, for compilers that support it. The default is off.对于支持MemoryManitizer的编译器,是否启用它。默认为关闭。
For this option to have an effect if enabled, all libraries linked to MySQL must also have been compiled with the option enabled.
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 has NUMA
support. For platforms without NUMA support, CMake behaves as follows:
With no NUMA option (the normal case), CMake continues normally, producing only this warning: NUMA library missing or required version not available
With -DWITH_NUMA=ON
, CMake aborts with this error: NUMA library missing or required version not available
For flags typically used for RPM and Debian packages, whether to add them to standalone builds on those platforms. The default is ON
for nondebug builds.
This option was added in MySQL 8.0.26.
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 use INSTALL_PRIV_LIBDIR
to modify the dynamic Protobuf library directory.
system
: Use the package installed on the system.:使用系统上安装的软件包。
Other values are ignored, with a fallback to 其他值将被忽略,并回退到bundled
.bundled
。
Whether to build the rapid development cycle plugins. When enabled, a 是否构建快速开发周期的插件。启用后,将在包含这些插件的构建树中创建一个rapid
directory is created in the build tree containing these plugins. rapid
目录。When disabled, no 禁用时,不会在生成树中创建rapid
directory is created in the build tree. rapid
目录。The default is 默认值为ON
, unless the rapid
directory is removed from the source tree, in which case the default becomes OFF
.ON
,除非从源树中删除rapid
目录,在这种情况下,默认值变为OFF
。
-DWITH_RAPIDJSON=
rapidjson_type
The type of RapidJSON library support to include. 要包含的RapidJSON库支持的类型。rapidjson_type
can be one of the following values:rapidjson_type
可以是以下值之一:
bundled
: Use the RapidJSON library bundled with the distribution. This is the default.:使用与发行版捆绑的RapidJSON库。这是默认设置。
system
: Use the system RapidJSON library. Version 1.1.0 or higher is required.:使用系统RapidJSON库。需要1.1.0或更高版本。
This option was added in MySQL 8.0.13.此选项是在MySQL 8.0.13中添加的。
The type of RE2 library support to include. 要包含的RE2库支持的类型。re2_type
can be one of the following values:re2_type
可以是以下值之一:
bundled
: Use the RE2 library bundled with the distribution. This is the default.:使用与发行版捆绑的RE2库。这是默认设置。
system
: Use the system RE2 library.:使用系统RE2库。
As of MySQL 8.0.18, MySQL no longer uses the RE2 library and this option was removed.从MySQL 8.0.18开始,MySQL不再使用RE2库,并且删除了此选项。
Whether to build MySQL Router. The default is 是否构建MySQL路由器。默认值为ON
.ON
。
This option was added in MySQL 8.0.16.此选项是在MySQL 8.0.16中添加的。
-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.为了支持加密连接、生成随机数的熵以及其他与加密相关的操作,MySQL必须使用SSL库构建。此选项指定要使用的SSL库。
ssl_type
can be one of the following values:可以是以下值之一:
system
: Use the system OpenSSL library. This is the default.:使用系统OpenSSL库。这是默认设置。
On macOS and Windows, using system
configures MySQL to build as if CMake was invoked with path_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 that system
can 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 for :这是system
.system
的同义词。
path_name
is the path name to the OpenSSL installation to use. path_name
是要使用的OpenSSL安装的路径名。This can be preferable to using the ssl_type
value of system
because it can prevent CMake from detecting and using an older or incorrect OpenSSL version installed on the system. (Another permitted way to do the same thing is to set WITH_SSL
to system
and set the CMAKE_PREFIX_PATH
option to path_name
.)
For additional information about configuring the SSL library, see Section 2.9.6, “Configuring SSL Library Support”.有关配置SSL库的更多信息,请参阅第2.9.6节,“配置SSL库支持”。
Whether to enable installation of systemd support files. 是否启用systemd支持文件的安装。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. 默认情况下,此选项处于禁用状态。启用后,将安装systemd支持文件,而不会安装mysqld_safe和System V初始化脚本等脚本。On platforms where systemd is not available, enabling 在systemd不可用的平台上,启用WITH_SYSTEMD
results in an error from CMake.WITH_SYSTEMD
会导致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
, WITH_ZSTD
.
Whether to produce additional systemd debugging information, for platforms on which systemd is used to run MySQL. The default is 是否为使用systemd运行MySQL的平台生成额外的systemd调试信息。默认值为OFF
.OFF
。
This option was added in MySQL 8.0.22.此选项是在MySQL 8.0.22中添加的。
Whether to link with 是否与-ltcmalloc
. -ltcmalloc
链接。If enabled, built-in 如果启用,则禁用内置的malloc()
, calloc()
, realloc()
, and free()
routines are disabled. malloc()
、calloc()
、realloc()
和free()
例程。The default is 默认值为OFF
.OFF
。
WITH_TCMALLOC
and WITH_JEMALLOC
are mutually exclusive.
This option was added in MySQL 8.0.22.此选项是在MySQL 8.0.22中添加的。
Whether to build the test protocol trace client plugin (see Using the Test Protocol Trace Plugin). By default, this option is disabled. Enabling this option has no effect unless the WITH_CLIENT_PROTOCOL_TRACING
option is enabled. If MySQL is configured with both options enabled, the libmysqlclient
client library is built with the test protocol trace plugin built in, and all the standard MySQL clients load the plugin. However, even when the test plugin is enabled, it has no effect by default. Control over the plugin is afforded using environment variables; see Using the Test Protocol Trace Plugin.使用环境变量提供对插件的控制;请参阅使用测试协议跟踪插件。
Do not enable the 如果您想使用自己的协议跟踪插件,请不要启用WITH_TEST_TRACE_PLUGIN
option if you want to use your own protocol trace plugins because only one such plugin can be loaded at a time and an error occurs for attempts to load a second one. WITH_TEST_TRACE_PLUGIN
选项,因为一次只能加载一个这样的插件,并且尝试加载第二个插件时会出错。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.如果你已经在启用测试协议跟踪插件的情况下构建了MySQL,看看它是如何工作的,那么在使用自己的插件之前,你必须在没有它的情况下重建MySQL。
For information about writing trace plugins, see Writing Protocol Trace Plugins.有关编写跟踪插件的信息,请参阅编写协议跟踪插件。
Whether to enable the ThreadSanitizer, for compilers that support it. The default is off.对于支持ThreadManitizer的编译器,是否启用它。默认为关闭。
Whether to enable the Undefined Behavior Sanitizer, for compilers that support it. The default is off.是否为支持Undefined Behavior Sanitizer的编译器启用它。默认为OFF
。
If enabled, compile MySQL with unit tests. The default is ON unless the server is not being compiled.如果启用,请使用单元测试编译MySQL。除非未编译服务器,否则默认值为ON
。
Enables unixODBC support, for Connector/ODBC.为连接器/ODBC启用unixODBC支持。
Whether to compile in the Valgrind header files, which exposes the Valgrind API to MySQL code. The default is 是否在Valgrind头文件中编译,这将Valgrind API暴露给MySQL代码。默认值为OFF
.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()
and UNCOMPRESS()
functions, and compression of the client/server protocol. COMPRESS()
和UNCOMPRESS()
函数,以及客户端/服务器协议的压缩。The WITH_ZLIB
indicates the source of zlib
support:WITH_ZLIB
表示zlib
支持的来源:
bundled
: Use the :使用与发行版捆绑在一起的zlib
library bundled with the distribution. This is the default.zlib
库。这是默认设置。
system
: Use the system zlib
library. If WITH_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.
Connection compression using the 使用zstd
algorithm (see Section 4.2.8, “Connection Compression Control”) requires that the server be built with zstd
library support. zstd
算法的连接压缩(请参阅第4.2.8节,“连接压缩控制”)要求服务器构建时支持zstd库。The WITH_ZSTD
indicates the source of zstd
support:WITH_ZSTD
表示zstd
支持的来源:
bundled
: Use the :使用与发行版捆绑的zstd
library bundled with the distribution. This is the default.zstd
库。这是默认设置。
system
: Use the system :使用系统zstd
library.zstd
库。
This option was added in MySQL 8.0.18.此选项是在MySQL 8.0.18中添加的。
Flags for the C Compiler.C编译器的标志。
Flags for the C++ Compiler.C++编译器的标志。
-DWITH_DEFAULT_COMPILER_OPTIONS=
bool
Whether to use the flags from 是否使用cmake/build_configurations/compiler_options.cmake
.cmake/build_configurations/compiler_options.cmake
中的标志。
All optimization flags were carefully chosen and tested by the MySQL build team. Overriding them can lead to unexpected results and is done at your own risk.所有优化标志都经过MySQL构建团队的精心选择和测试。超越它们可能会导致意想不到的结果,而且风险自负。
To specify your own C and C++ compiler flags, for flags that do not affect optimization, use the 要指定自己的C和C++编译器标志,对于不影响优化的标志,请使用CMAKE_C_FLAGS
and CMAKE_CXX_FLAGS
CMake options.CMAKE_C_FLAGS
和CMAKE_CXX_FLAGS
CMAKE选项。
When providing your own compiler flags, you might want to specify 在提供自己的编译器标志时,可能还需要指定CMAKE_BUILD_TYPE
as well.CMAKE_BUILD_TYPE
。
For example, to create a 32-bit release build on a 64-bit Linux machine, do this:例如,要在64位Linux计算机上创建32位版本构建,请执行以下操作:
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.以下选项用于构建支持NDB集群的MySQL 8.0源代码。
Perform the build using the memcached (version 1.6 or later) installed in the system directory indicated by 使用安装在dir_name
. dir_name
指示的系统目录中的memcached(版本1.6或更高版本)执行构建。Files from this installation that are used in the build include the memcached binary, header files, and libraries, as well as the 此安装中用于生成的文件包括memcached二进制文件、头文件和库,以及memcached_utilities
library and the header file engine_testapp.h
.memcached_utilities
库和头文件engine_testap.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.
-NDB_UTILS_LINK_DYNAMIC={ON|OFF}
Controls whether NDB utilities such as ndb_drop_table are linked with ndbclient
statically (OFF
) or dynamically (ON
); OFF
(static linking) is the default. Normally static linking is used whe building these to avoid problems with LD_LIBRARY_PATH
, or when multiple versions of ndbclient
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.此选项用于创建Docker图像,以及可能的其他情况,其中目标环境受到精确控制,并且希望减小图像大小。
Added in NDB 8.0.22.
-DWITH_BUNDLED_LIBEVENT={ON|OFF}
Use the libevent
included in the NDB Cluster sources when building NDB Cluster with ndbmemcached
support. Enabled by default. OFF
causes the system's libevent
to be used instead.
-DWITH_BUNDLED_MEMCACHED={ON|OFF}
Build the memcached sources included in the 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 installation bin
directory, and the ndbmemcache
engine shared library file ndb_engine.so
in the installation lib
directory.
This option is ON by default.默认情况下,此选项为ON
。
Sets the classpath for building NDB Cluster Connector for Java. The default is empty. 设置用于构建Java的NDB集群连接器的类路径。默认值为空。This option is ignored if 如果使用-DWITH_NDB_JAVA=OFF
is used.-DWITH_NDB_JAVA=OFF
,则会忽略此选项。
Enables error injection in the 启用NDB
kernel. For testing only; not intended for use in building production binaries. The default is OFF
.ND
B内核中的错误注入。仅用于测试;不用于构建生产二进制文件。默认值为OFF
。
-DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}
This is an alias for 这是WITH_NDBCLUSTER
.WITH_NDBCLUSTER
的别名。
Build and link in support for the NDB
(NDBCLUSTER
) storage engine in mysqld. The default is ON
.
Build the multithreaded data node executable ndbmtd. The default is ON
.
Enable binary logging by default in the mysqld built using this option. ON by default.
Enable building the debug versions of the NDB Cluster binaries. OFF by default.启用构建NDB群集二进制文件的调试版本。默认情况下为OFF
。
Enable building NDB Cluster with Java support, including 支持构建具有Java支持的NDB集群,包括ClusterJ
.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 默认情况下,此选项为ON。如果不希望使用Java支持编译NDB Cluster,则必须在运行CMake时通过指定-DWITH_NDB_JAVA=OFF
when running CMake. -DWITH_NDB_Java=OFF
来显式禁用它。Otherwise, if Java cannot be found, configuration of the build fails.否则,若找不到Java,构建的配置就会失败。
Causes the NDB Cluster management server (ndb_mgmd) that is built to use this 默认情况下,使生成的NDB群集管理服务器(NDB_mgmd)使用此port
by default. port
。If this option is unset, the resulting management server tries to use port 1186 by default.如果未设置此选项,则默认情况下,生成的管理服务器会尝试使用端口1186。
If enabled, include a set of NDB API test programs. The default is OFF.如果启用,请包含一组NDB API测试程序。默认值为OFF
。
-DWITH_PLUGIN_NDBCLUSTER={ON|OFF}
Alias for WITH_NDBCLUSTER
.WITH_NDBCLUSTER
的别名。