2.9.7 MySQL Source-Configuration OptionsMySQL源配置选项

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 ON to enable the option, or as 0 or OFF to disable the option.对于布尔选项,该值可以指定为1或ON以启用该选项,也可以指定为0或OFF以禁用该选项。

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. 例如,配置默认安装基本目录位置、TCP/IP端口号和UNIX套接字文件的CMAKE_INSTALL_PREFIXMYSQL_TCP_PORTMYSQL_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选项的更多信息。

CMake Option ReferenceCMake选项参考

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)

Formats格式Description描述Default默认值Introduced引入版本Removed删除版本
ADD_GDB_INDEXWhether to enable generation of .gdb_index section in binaries是否启用在二进制文件中生成.gdb_index节8.0.18
BUILD_CONFIGUse same build options as official releases使用与官方版本相同的构建选项
BUNDLE_RUNTIME_LIBRARIESBundle runtime libraries with server MSI and Zip packages for Windows将运行库与用于Windows的服务器MSI和Zip包捆绑在一起OFF
CMAKE_BUILD_TYPEType of build to produce要生成的生成类型RelWithDebInfo
CMAKE_CXX_FLAGSFlags for C++ CompilerC++编译器的标志
CMAKE_C_FLAGSFlags for C CompilerC编译器的标志
CMAKE_INSTALL_PREFIXInstallation base directory安装基本目录/usr/local/mysql
COMPILATION_COMMENTComment about compilation environment关于编译环境的评论
COMPILATION_COMMENT_SERVERComment about compilation environment for use by mysqld关于mysqld使用的编译环境的评论8.0.14
COMPRESS_DEBUG_SECTIONSCompress debug sections of binary executables压缩二进制可执行文件的调试部分OFF8.0.22
CPACK_MONOLITHIC_INSTALLWhether package build produces single file包生成是否生成单个文件OFF
DEFAULT_CHARSETThe default server character set默认的服务器字符集utf8mb4
DEFAULT_COLLATIONThe default server collation默认的服务器排序规则utf8mb4_0900_ai_ci
DISABLE_PSI_CONDExclude Performance Schema condition instrumentation排除性能架构条件检测OFF
DISABLE_PSI_DATA_LOCKExclude the performance schema data lock instrumentation排除性能架构数据锁定检测OFF
DISABLE_PSI_ERRORExclude the performance schema server error instrumentation排除性能架构服务器错误检测OFF
DISABLE_PSI_FILEExclude Performance Schema file instrumentation排除性能架构文件检测OFF
DISABLE_PSI_IDLEExclude Performance Schema idle instrumentation排除性能架构空闲检测OFF
DISABLE_PSI_MEMORYExclude Performance Schema memory instrumentation排除性能架构内存检测OFF
DISABLE_PSI_METADATAExclude Performance Schema metadata instrumentation排除性能架构元数据检测OFF
DISABLE_PSI_MUTEXExclude Performance Schema mutex instrumentation排除性能架构互斥检测OFF
DISABLE_PSI_PSExclude the performance schema prepared statements排除性能架构准备的语句OFF
DISABLE_PSI_RWLOCKExclude Performance Schema rwlock instrumentation排除性能架构rwlock检测OFF
DISABLE_PSI_SOCKETExclude Performance Schema socket instrumentation排除性能架构套接字检测OFF
DISABLE_PSI_SPExclude Performance Schema stored program instrumentation排除性能架构存储程序检测OFF
DISABLE_PSI_STAGEExclude Performance Schema stage instrumentation排除性能架构阶段检测OFF
DISABLE_PSI_STATEMENTExclude Performance Schema statement instrumentation排除性能架构语句检测OFF
DISABLE_PSI_STATEMENT_DIGESTExclude Performance Schema statements_digest instrumentation排除性能架构语句_dgest指令插入OFF
DISABLE_PSI_TABLEExclude Performance Schema table instrumentation排除性能架构表检测OFF
DISABLE_PSI_THREADExclude the performance schema thread instrumentation排除性能架构线程检测OFF
DISABLE_PSI_TRANSACTIONExclude the performance schema transaction instrumentation排除性能架构事务检测OFF
DISABLE_SHAREDDo not build shared libraries, compile position-dependent code不构建共享库,编译位置相关代码OFF8.0.18
DOWNLOAD_BOOSTWhether to download the Boost library是否下载Boost库OFF
DOWNLOAD_BOOST_TIMEOUTTimeout in seconds for downloading the Boost library下载Boost库的超时时间(秒)600
ENABLED_LOCAL_INFILEWhether to enable LOCAL for LOAD DATA是否为LOAD DATA启用LOCALOFF
ENABLED_PROFILINGWhether to enable query profiling code是否启用查询分析代码ON
ENABLE_DOWNLOADSWhether to download optional files是否下载可选文件OFF8.0.26
ENABLE_EXPERIMENTAL_SYSVARSWhether to enabled experimental InnoDB system variables是否启用实验InnoDB系统变量OFF
ENABLE_GCOVWhether to include gcov support是否包括gcov支持
ENABLE_GPROFEnable gprof (optimized Linux builds only)启用gprof(仅限优化的Linux版本)OFF
FORCE_INSOURCE_BUILDWhether to force an in-source build是否强制源代码内构建OFF8.0.14
FORCE_UNSUPPORTED_COMPILERWhether to permit unsupported compiler是否允许不支持的编译器OFF
FPROFILE_GENERATEWhether to generate profile guided optimization data是否生成剖面导向优化数据OFF8.0.19
FPROFILE_USEWhether to use profile guided optimization data是否使用配置文件引导的优化数据OFF8.0.19
HAVE_PSI_MEMORY_INTERFACEEnable performance schema memory tracing module for memory allocation functions used in dynamic storage of over-aligned types为过对齐类型的动态存储中使用的内存分配函数启用性能模式内存跟踪模块OFF8.0.26
IGNORE_AIO_CHECKWith -DBUILD_CONFIG=mysql_release, ignore libaio check使用-DBUILD_CONFIG=mysql_release时,忽略libaio检查OFF
INSTALL_BINDIRUser executables directory用户可执行文件目录PREFIX/bin
INSTALL_DOCDIRDocumentation directory文档目录PREFIX/docs
INSTALL_DOCREADMEDIRREADME file directory自述文件目录PREFIX
INSTALL_INCLUDEDIRHeader file directory头文件目录PREFIX/include
INSTALL_INFODIRInfo file directory信息文件目录PREFIX/docs
INSTALL_LAYOUTSelect predefined installation layout选择预定义的安装布局STANDALONE
INSTALL_LIBDIRLibrary file directory库文件目录PREFIX/lib
INSTALL_MANDIRManual page directory手动页面目录PREFIX/man
INSTALL_MYSQLKEYRINGDIRDirectory for keyring_file plugin data filekeyring_file插件数据文件的目录platform specific
INSTALL_MYSQLSHAREDIRShared data directory共享数据目录PREFIX/share
INSTALL_MYSQLTESTDIRmysql-test directory目录PREFIX/mysql-test
INSTALL_PKGCONFIGDIRDirectory for mysqlclient.pc pkg-config filemysqlclient.pc pkg配置文件的目录INSTALL_LIBDIR/pkgconfig
INSTALL_PLUGINDIRPlugin directory插件目录PREFIX/lib/plugin
INSTALL_PRIV_LIBDIRInstallation private library directory安装专用库目录8.0.18
INSTALL_SBINDIRServer executable directory服务器可执行目录PREFIX/bin
INSTALL_SECURE_FILE_PRIVDIRsecure_file_priv default value默认值platform specific
INSTALL_SHAREDIRaclocal/mysql.m4 installation directory安装目录PREFIX/share
INSTALL_STATIC_LIBRARIESWhether to install static libraries是否安装静态库ON
INSTALL_SUPPORTFILESDIRExtra support files directory额外的支持文件目录PREFIX/support-files
LINK_RANDOMIZEWhether to randomize order of symbols in mysqld binary是否随机化mysqld二进制中的符号顺序OFF
LINK_RANDOMIZE_SEEDSeed value for LINK_RANDOMIZE optionLINK_RANDOMIZE选项的种子值mysql
MAX_INDEXESMaximum indexes per table每个表的最大索引64
MUTEX_TYPEInnoDB mutex type互斥类型event
MYSQLX_TCP_PORTTCP/IP port number used by X PluginX插件使用的TCP/IP端口号33060
MYSQLX_UNIX_ADDRUnix socket file used by X PluginX插件使用的Unix套接字文件/tmp/mysqlx.sock
MYSQL_DATADIRData directory数据目录
MYSQL_MAINTAINER_MODEWhether to enable MySQL maintainer-specific development environment是否启用MySQL维护者特定的开发环境OFF
MYSQL_PROJECT_NAMEWindows/macOS project nameWindows/macOS项目名称MySQL
MYSQL_TCP_PORTTCP/IP port numberTCP/IP端口号3306
MYSQL_UNIX_ADDRUnix socket fileUnix套接字文件/tmp/mysql.sock
NDB_UTILS_LINK_DYNAMICCause NDB tools to be dynamically linked to ndbclient使NDB工具动态链接到ndbclient8.0.22-ndb-8.0.22
ODBC_INCLUDESODBC includes directoryODBC包括目录
ODBC_LIB_DIRODBC library directoryODBC库目录
OPTIMIZER_TRACEWhether to support optimizer tracing是否支持优化器跟踪
REPRODUCIBLE_BUILDTake extra care to create a build result independent of build location and time要特别注意创建独立于生成位置和时间的生成结果
SYSCONFDIROption file directory选项文件目录
SYSTEMD_PID_DIRDirectory for PID file under systemdsystemd下PID文件的目录/var/run/mysqld
SYSTEMD_SERVICE_NAMEName of MySQL service under systemdsystemd下MySQL服务的名称mysqld
TMPDIRtmpdir default valuetmpdir默认值
USE_LD_GOLDWhether to use GNU gold linker是否使用GNU黄金链接器ON
USE_LD_LLDWhether to use llvm lld linker是否使用llvm lld链接器ON8.0.16
WIN_DEBUG_NO_INLINEWhether to disable function inlining是否禁用函数内联OFF
WITHOUT_xxx_STORAGE_ENGINEExclude storage engine xxx from build从生成中排除存储引擎xxx
WITH_ANTPath to Ant for building GCS Java wrapper构建GCS Java包装器的Ant路径
WITH_ASANEnable AddressSanitizer启用AddressSanitizerOFF
WITH_ASAN_SCOPEEnable AddressSanitizer -fsanitize-address-use-after-scope Clang flag启用AddressSanitizer -fsanitize-address-use-after-scope Clang标志OFF
WITH_AUTHENTICATION_CLIENT_PLUGINSEnabled automatically if any corresponding server authentication plugins are built如果构建了任何相应的服务器身份验证插件,则自动启用8.0.26
WITH_AUTHENTICATION_LDAPWhether to report error if LDAP authentication plugins cannot be built如果无法构建LDAP身份验证插件,是否报告错误OFF
WITH_AUTHENTICATION_PAMBuild PAM authentication plugin构建PAM身份验证插件OFF
WITH_AWS_SDKLocation of Amazon Web Services software development kit亚马逊网络服务软件开发工具包的位置
WITH_BOOSTThe location of the Boost library sourcesBoost库源的位置
WITH_CLIENT_PROTOCOL_TRACINGBuild client-side protocol tracing framework构建客户端协议跟踪框架ON
WITH_CURLLocation of curl librarycurl库的位置
WITH_DEBUGWhether to include debugging support是否包括调试支持OFF
WITH_DEFAULT_COMPILER_OPTIONSWhether to use default compiler options是否使用默认编译器选项ON
WITH_DEFAULT_FEATURE_SETWhether to use default feature set是否使用默认功能集ON8.0.22
WITH_EDITLINEWhich libedit/editline library to use要使用哪个libedit/editline库bundled
WITH_GMOCKPath to googlemock distributiongooglemock分发路径8.0.26
WITH_ICUType of ICU supportICU支持类型bundled
WITH_INNODB_EXTRA_DEBUGWhether to include extra debugging support for InnoDB.是否包括对InnoDB的额外调试支持。OFF
WITH_INNODB_MEMCACHEDWhether to generate memcached shared libraries.是否生成memcached共享库。OFF
WITH_JEMALLOCWhether to link with -ljemalloc是否与-ljemalloc链接OFF8.0.16
WITH_KEYRING_TESTBuild the keyring test program建立钥匙圈测试程序OFF
WITH_LIBEVENTWhich libevent library to use要使用哪个libevent库bundled
WITH_LIBWRAPWhether to include libwrap (TCP wrappers) support是否包括libwrap(TCP包装器)支持OFF
WITH_LOCK_ORDERWhether to enable LOCK_ORDER tooling是否启用LOCK_ORDER工具OFF8.0.17
WITH_LSANWhether to run LeakSanitizer, without AddressSanitizer是否在没有AddressSanitizer的情况下运行LeakSanitizerOFF8.0.16
WITH_LTOEnable link-time optimizer启用链接时间优化器OFF8.0.13
WITH_LZ4Type of LZ4 library supportLZ4库支持的类型bundled
WITH_LZMAType of LZMA library supportLZMA库支持的类型bundled8.0.16
WITH_MECABCompiles MeCab编译MeCab
WITH_MSANEnable MemorySanitizer启用MemoryManitizerOFF
WITH_MSCRT_DEBUGEnable Visual Studio CRT memory leak tracing启用Visual Studio CRT内存泄漏跟踪OFF
WITH_MYSQLXWhether to disable X Protocol是否禁用X协议ON
WITH_NUMASet NUMA memory allocation policy设置NUMA内存分配策略
WITH_PACKAGE_FLAGSFor flags typically used for RPM/DEB packages, whether to add them to standalone builds on those platforms对于通常用于RPM/DEB包的标志,是否将它们添加到这些平台上的独立构建中8.0.26
WITH_PROTOBUFWhich Protocol Buffers package to use要使用的协议缓冲程序包bundled
WITH_RAPIDWhether to build rapid development cycle plugins是否构建快速开发周期插件ON
WITH_RAPIDJSONType of RapidJSON supportRapidJSON支持类型bundled8.0.13
WITH_RE2Type of RE2 library supportRE2库支持的类型bundled8.0.18
WITH_ROUTERWhether to build MySQL Router是否构建MySQL路由器ON8.0.16
WITH_SSLType of SSL supportSSL支持的类型system
WITH_SYSTEMDEnable installation of systemd support files启用systemd支持文件的安装OFF
WITH_SYSTEMD_DEBUGEnable additional systemd debug information启用其他系统调试信息OFF8.0.22
WITH_SYSTEM_LIBSSet system value of library options not set explicitly设置未明确设置的库选项的系统值OFF
WITH_TCMALLOCWhether to link with -ltcmalloc是否与-ltcmalloc链接OFF8.0.22
WITH_TEST_TRACE_PLUGINBuild test protocol trace plugin构建测试协议跟踪插件OFF
WITH_TSANEnable ThreadSanitizer启用ThreadManitizerOFF
WITH_UBSANEnable Undefined Behavior Sanitizer启用未定义的行为消毒器OFF
WITH_UNIT_TESTSCompile MySQL with unit tests使用单元测试编译MySQLON
WITH_UNIXODBCEnable unixODBC support启用unixODBC支持OFF
WITH_VALGRINDWhether to compile in Valgrind header files是否在Valgrind头文件中编译OFF
WITH_ZLIBType of zlib supportzlib支持的类型bundled
WITH_ZSTDType of zstd supportzstd支持类型bundled8.0.18
WITH_xxx_STORAGE_ENGINECompile storage engine xxx statically into server将存储引擎xxx静态编译到服务器中

General Options常规选项

  • -DBUILD_CONFIG=mysql_release

    This option configures a source distribution with the same build options used by Oracle to produce binary distributions for official MySQL releases.此选项使用Oracle用于为正式MySQL版本生成二进制发行版的相同构建选项配置源发行版。

  • -DBUNDLE_RUNTIME_LIBRARIES=bool

    Whether to bundle runtime libraries with server MSI and Zip packages for Windows.是否将运行库与适用于Windows的服务器MSI和Zip包捆绑在一起。

  • -DCMAKE_BUILD_TYPE=type

    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安装的一个子集,则这可能很有用。如果启用,它将生成用于安装所有内容的单个文件。

  • -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_INSOURCE_BUILD=ON调用CMake

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. 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选项进行设置。

  • -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.README文件的安装位置。

  • -DINSTALL_INCLUDEDIR=dir_name

    Where to install header files.在何处安装头文件。

  • -DINSTALL_INFODIR=dir_name

    Where to install Info files.信息文件的安装位置。

  • -DINSTALL_LAYOUT=name

    Select a predefined installation layout:选择预定义的安装布局:

    • STANDALONE: Same layout as used for .tar.gz and .zip packages. This is the default.:与用于.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_privkeyring_encrypted_file_datakeyring_file_data系统变量的默认值。请参阅第5.1.8节,“服务器系统变量”第6.4.4.18节,“密钥系统变量”中对这些变量的描述。

  • -DINSTALL_LIBDIR=dir_name

    Where to install library files.在何处安装库文件。

  • -DINSTALL_MANDIR=dir_name

    Where to install manual pages.手册页的安装位置。

  • -DINSTALL_MYSQLKEYRINGDIR=dir_path

    The default directory to use as the location of the keyring_file plugin data file. 要用作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结尾,在这种情况下,它将首先被删除。

  • -DINSTALL_PLUGINDIR=dir_name

    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 libprotobuf.so files without help. 对于Protobuf:因为这是一个私有位置,加载程序(如Linux上的ld linuxso)在没有帮助的情况下可能找不到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 RPATH which contains $ORIGIN. 这适用于大多数情况,但当使用资源组功能时,mysqldsetuid,然后loader会忽略包含$ORIGINRPATHTo 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进行修补。

  • -DINSTALL_SBINDIR=dir_name

    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系统变量的描述。

  • -DINSTALL_SHAREDIR=dir_name

    Where to install aclocal/mysql.m4.在何处安装aclocal/mysql.m4

  • -DINSTALL_STATIC_LIBRARIES=bool

    Whether to install static libraries. 是否安装静态库。The default is ON. 默认值为ONIf set to OFF, these libraries are not installed: libmysqlclient.a, libmysqlservices.a.如果设置为OFF,则不会安装以下库:libmysqlclient.alibmysqlservices.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. 是否随机化mysqld二进制文件中的符号顺序。The default is OFF. This option should be enabled only for debugging purposes.默认值为OFF。此选项应仅用于调试目的。

  • -DLINK_RANDOMIZE_SEED=val

    Seed value for the LINK_RANDOMIZE option. LINK_RANDOMIZE选项的种子值。The value is a string. The default is mysql, an arbitrary choice.值是一个字符串。默认值是mysql,这是一个任意选择。

  • -DMYSQL_DATADIR=dir_name

    The location of the MySQL data directory.MySQL数据目录的位置。

    This value can be set at server startup with the --datadir option.该值可以在服务器启动时使用--datadir选项进行设置。

  • -DODBC_INCLUDES=dir_name

    The location of the ODBC includes directory, and may be used while configuring Connector/ODBC.ODBC的位置包括目录,并且可以在配置连接器/ODBC时使用。

  • -DODBC_LIB_DIR=dir_name

    The location of the ODBC library directory, and may be used while configuring Connector/ODBC.ODBC库目录的位置,并且可以在配置连接器/ODBC时使用。

  • -DSYSCONFDIR=dir_name

    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=file_name option, where file_name is the full path name to the file.无法在服务器启动时设置此位置,但可以使用--defaults-file=file_name选项使用给定的选项文件启动服务器,其中file_name是文件的完整路径名。

  • -DSYSTEMD_PID_DIR=dir_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,否则会忽略此选项。

  • -DSYSTEMD_SERVICE_NAME=name

    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,否则会忽略此选项。

  • -DTMPDIR=dir_name

    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 Engine Options存储引擎选项

Storage engines are built as plugins. 存储引擎是作为插件构建的。You can build a plugin as a static module (compiled into the server) or a dynamic module (built as a dynamic library that must be installed into the server using the INSTALL PLUGIN statement or the --plugin-load option before it can be used). 您可以将插件构建为静态模块(编译到服务器中)或动态模块(构建为动态库,必须使用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.InnoDBMyISAMMERGEMEMORYCSV引擎是强制性的(总是编译到服务器中),不需要显式安装。

To compile a storage engine statically into the server, use -DWITH_engine_STORAGE_ENGINE=1. 要将存储引擎静态编译到服务器中,请使用-DWITH_engine_STORAGE_ENGINE=1Some permissible engine values are ARCHIVE, BLACKHOLE, EXAMPLE, FEDERATED, and NDB or NDBCLUSTER (NDB support). 一些允许的engine值为ARCHIVEBLACKHOLEEXAMPLEFEDERATEDNDBNDBCLUSTERNDB支持)。Examples:示例:

-DWITH_ARCHIVE_STORAGE_ENGINE=1
-DWITH_BLACKHOLE_STORAGE_ENGINE=1
Note注意

It is not possible to compile without Performance Schema support. If it is desired to compile without particular types of instrumentation, that can be done with the 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_engine_STORAGE_ENGINE=0. Examples:要从生成中排除存储引擎,请使用-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_engine_STORAGE_ENGINE=1 (but -DWITH_engine_STORAGE_ENGINE=0 is preferred). Examples:

-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1

If neither -DWITH_engine_STORAGE_ENGINE nor -DWITHOUT_engine_STORAGE_ENGINE are specified for a given storage engine, the engine is built as a shared module, or excluded if it cannot be built as a shared module.

Feature Options功能选项

  • -DADD_GDB_INDEX=bool

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

    This option was added in MySQL 8.0.18.

  • -DCOMPILATION_COMMENT=string

    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选项进行设置。

  • -DDISABLE_PSI_COND=bool

    Whether to exclude the Performance Schema condition instrumentation. The default is OFF (include).是否排除性能架构条件检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_FILE=bool

    Whether to exclude the Performance Schema file instrumentation. The default is OFF (include).是否排除性能架构文件检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_IDLE=bool

    Whether to exclude the Performance Schema idle instrumentation. The default is OFF (include).是否排除性能架构空闲检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_MEMORY=bool

    Whether to exclude the Performance Schema memory instrumentation. The default is OFF (include).是否排除性能架构内存检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_METADATA=bool

    Whether to exclude the Performance Schema metadata instrumentation. The default is OFF (include).是否排除性能架构元数据检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_MUTEX=bool

    Whether to exclude the Performance Schema mutex instrumentation. The default is OFF (include).是否排除性能架构互斥检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_RWLOCK=bool

    Whether to exclude the Performance Schema rwlock instrumentation. The default is OFF (include).是否排除性能架构rwlock检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_SOCKET=bool

    Whether to exclude the Performance Schema socket instrumentation. The default is OFF (include).是否排除性能架构套接字检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_SP=bool

    Whether to exclude the Performance Schema stored program instrumentation. The default is OFF (include).是否排除性能架构存储程序检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_STAGE=bool

    Whether to exclude the Performance Schema stage instrumentation. The default is OFF (include).是否排除性能架构阶段检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_STATEMENT=bool

    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 OFF (include).是否排除性能架构statement_dgest指令插入。默认值为OFF(包括)。

  • -DDISABLE_PSI_TABLE=bool

    Whether to exclude the Performance Schema table instrumentation. The default is OFF (include).是否排除性能架构表检测。默认值为OFF(包括)。

  • -DDISABLE_SHARED=bool

    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中删除。

  • -DDISABLE_PSI_PS=bool

    Exclude the performance schema prepared statements instances instrumentation. The default is OFF (include).排除性能架构准备的语句实例检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_THREAD=bool

    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(包括)。

  • -DDISABLE_PSI_DATA_LOCK=bool

    Exclude the performance schema data lock instrumentation. The default is OFF (include).排除性能架构数据锁定检测。默认值为OFF(包括)。

  • -DDISABLE_PSI_ERROR=bool

    Exclude the performance schema server error instrumentation. The default is OFF (include).排除性能架构服务器错误检测。默认值为OFF(包括)。

  • -DDOWNLOAD_BOOST=bool

    Whether to download the Boost library. The default is OFF.是否下载Boost库。默认值为OFF

    See the WITH_BOOST option for additional discussion about using Boost.有关使用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 WITH_BOOST option for additional discussion about using Boost.有关使用BOOST的更多讨论,请参阅WITH_BOOST选项。

  • -DENABLE_DOWNLOADS=bool

    Whether to download optional files. For example, with this option enabled, CMake downloads the Google Test distribution that is used by the test suite to run unit tests, 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.

  • -DENABLE_GCOV=bool

    Whether to include gcov support (Linux only).是否包括gcov支持(仅限Linux)。

  • -DENABLE_GPROF=bool

    Whether to enable gprof (optimized Linux builds only).

  • -DENABLED_LOCAL_INFILE=bool

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

  • -DENABLED_PROFILING=bool

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

  • -DFORCE_UNSUPPORTED_COMPILER=bool

    By default, CMake checks for minimum versions of supported compilers: 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.

  • -DFPROFILE_GENERATE=bool

    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中添加的。

  • -DFPROFILE_USE=bool

    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_name library functions) used in dynamic storage of over-aligned types.是否为过对齐类型的动态存储中使用的内存分配函数(ut::aligned_name库函数)启用性能模式内存跟踪模块。

  • -DIGNORE_AIO_CHECK=bool

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

  • -DMAX_INDEXES=num

    The maximum number of indexes per table. The default is 64. The maximum is 255. Values smaller than 64 are ignored and the default of 64 is used.每个表的最大索引数。默认值为64。最大值为255。将忽略小于64的值,并使用默认值64。

  • -DMYSQL_MAINTAINER_MODE=bool

    Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors.是否启用MySQL维护者特定的开发环境。如果启用,此选项会导致编译器警告变为错误。

  • -DMUTEX_TYPE=type

    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而不是条件变量来调度等待线程。

  • -DMYSQLX_TCP_PORT=port_num

    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系统变量进行设置。

  • -DMYSQLX_UNIX_ADDR=file_name

    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系统变量进行设置。

  • -DMYSQL_PROJECT_NAME=name

    For Windows or macOS, the project name to incorporate into the project file name.对于Windows或macOS,要合并到项目文件名中的项目名称。

  • -DMYSQL_TCP_PORT=port_num

    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选项进行设置。

  • -DMYSQL_UNIX_ADDR=file_name

    The Unix socket file path on which the server listens for socket connections. This must be an absolute path name. Unix套接字文件路径,服务器在该路径上侦听套接字连接。这必须是一个绝对路径名。The default is /tmp/mysql.sock.默认值为/tmp/mysql.sock

    This value can be set at server startup with the --socket option.这个值可以在服务器启动时使用--socket选项进行设置。

  • -DOPTIMIZER_TRACE=bool

    Whether to support optimizer tracing. See MySQL Internals: Tracing the Optimizer.是否支持优化器跟踪。请参阅MySQL内部:跟踪优化器

  • -DREPRODUCIBLE_BUILD=bool

    For builds on Linux systems, this option controls whether to take extra care to create a build result independent of build location and time.对于Linux系统上的构建,此选项控制是否要格外小心地创建独立于构建位置和时间的构建结果。

    This option was added in MySQL 8.0.11. As of MySQL 8.0.12, it defaults to ON for RelWithDebInfo builds.此选项是在MySQL 8.0.11中添加的。从MySQL 8.0.12开始,对于RelWithDebInfo构建,它默认为ON

  • -DUSE_LD_GOLD=bool

    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选项。

  • -DUSE_LD_LLD=bool

    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中添加的。

  • -DWIN_DEBUG_NO_INLINE=bool

    Whether to disable function inlining on Windows. The default is off (inlining enabled).是否在Windows上禁用函数内联。默认为关闭(启用内联)。

  • -DWITH_ANT=path_name

    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.

  • -DWITH_ASAN=bool

    Whether to enable the AddressSanitizer, for compilers that support it. The default is off.对于支持AddressSanitizer的编译器,是否启用它。默认为关闭。

  • -DWITH_ASAN_SCOPE=bool

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

  • -DWITH_AUTHENTICATION_CLIENT_PLUGINS=bool

    This option is enabled automatically if any corresponding server authentication plugins are built. Its value thus depends on 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.

  • -DWITH_AWS_SDK=path_name

    The location of the Amazon Web Services software development kit.亚马逊网络服务软件开发工具包的位置。

  • -DWITH_BOOST=path_name

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

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

      -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=bool specifies whether to download the Boost source if it is not present in the specified location. The default is OFF.

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

    For example, if you normally build MySQL placing the object output in the bld subdirectory of your MySQL source tree, you can build with Boost like this:例如,如果你通常构建MySQL,将对象输出放在MySQL源树的bld子目录中,你可以像这样使用Boost构建:

    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.这将导致Boost被下载到主目录下的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 bld folder, recreate it, and perform the cmake step again. Otherwise, the new Boost version might not get downloaded, and compilation might fail.使用上述允许Boost下载到指定位置的设置,当所需的Boost版本发生变化时,您需要删除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.

  • -DWITH_CURL=curl_type

    The location of the curl library. curl_type can be system (use the system curl library) or a path name to the curl library.

  • -DWITH_DEBUG=bool

    Whether to include debugging support.是否包括调试支持。

    Configuring MySQL with debugging support enables you to use the --debug="d,parser_debug" option when you start the server. This causes the Bison parser that is used to process SQL statements to dump a parser trace to the server's standard error output. Typically, this output is written to the error log.

    Sync debug checking for 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=N option, where N is a timeout value greater than 0. (The default value is 0, which disables Debug Sync.) N becomes the default timeout for individual synchronization points.

    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.

  • -DWITH_EDITLINE=value

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

  • -DWITH_GMOCK=path_name

    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 WITH_ICU option indicates the type of ICU support to include or the path name to the ICU installation to use.MySQL使用International Components for Unicode(ICU)来支持正则表达式操作。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.

  • -DWITH_INNODB_MEMCACHED=bool

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

  • -DWITH_JEMALLOC=bool

    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.

  • -DWITH_KEYRING_TEST=bool

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

  • -DWITH_LIBEVENT=string

    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.

  • -DWITH_LIBWRAP=bool

    Whether to include libwrap (TCP wrappers) support.

  • -DWITH_LOCK_ORDER=bool

    Whether to enable LOCK_ORDER tooling. By default, this option is disabled and server builds contain no tooling. If tooling is enabled, the LOCK_ORDER tool is available and can be used as described in Section 5.9.3, “The LOCK_ORDER Tool”.是否启用LOCK_ORDER工具。默认情况下,此选项处于禁用状态,并且服务器构建不包含任何工具。如果启用了工具,则LOCK_ORDER工具可用,并且可以按照第5.9.3节,“LOCK_ORDER工具”中的说明使用。

    Note注意

    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.

  • -DWITH_LSAN=bool

    Whether to run LeakSanitizer, without AddressSanitizer. The default is OFF.是否在没有AddressSanitizer的情况下运行LeakSanitizer。默认值为OFF

    This option was added in MySQL 8.0.16.此选项是在MySQL 8.0.16中添加的。

  • -DWITH_LTO=bool

    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中添加的。

  • -DWITH_LZ4=lz4_type

    The WITH_LZ4 indicates the source of zlib support:

    • bundled: Use the lz4 library bundled with the distribution. This is the default.:使用与发行版捆绑的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.

  • -DWITH_LZMA=lzma_type

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

  • -DWITH_MSAN=bool

    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.

  • -DWITH_MSCRT_DEBUG=bool

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

  • -DWITH_MYSQLX=bool

    Whether to build with support for X Plugin. Default ON. See Chapter 20, Using MySQL as a Document Store.

  • -DWITH_NUMA=bool

    Explicitly set the NUMA memory allocation policy. CMake sets the default WITH_NUMA value based on whether the current platform has NUMA support. For platforms without NUMA support, CMake behaves as follows:

    • With no NUMA option (the normal case), CMake continues normally, producing only this warning: NUMA library missing or required version not available

    • With -DWITH_NUMA=ON, CMake aborts with this error: NUMA library missing or required version not available

  • -DWITH_PACKAGE_FLAGS=bool

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

    This option was added in MySQL 8.0.26.

  • -DWITH_PROTOBUF=protobuf_type

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

    • bundled: Use the package bundled with the distribution. This is the default. Optionally 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

  • -DWITH_RAPID=bool

    Whether to build the rapid development cycle plugins. When enabled, a rapid directory is created in the build tree containing these plugins. 是否构建快速开发周期的插件。启用后,将在包含这些插件的构建树中创建一个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中添加的。

  • -DWITH_RE2=re2_type

    The type of RE2 library support to include. re2_type can be one of the following values:要包含的RE2库支持的类型。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库,并且删除了此选项。

  • -DWITH_ROUTER=bool

    Whether to build MySQL Router. The default is ON.是否构建MySQL路由器。默认值为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库支持”

  • -DWITH_SYSTEMD=bool

    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 WITH_SYSTEMD results in an error from CMake.在systemd不可用的平台上,启用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.

  • -DWITH_SYSTEM_LIBS=bool

    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.

  • -DWITH_SYSTEMD_DEBUG=bool

    Whether to produce additional systemd debugging information, for platforms on which systemd is used to run MySQL. The default is OFF.是否为使用systemd运行MySQL的平台生成额外的systemd调试信息。默认值为OFF

    This option was added in MySQL 8.0.22.此选项是在MySQL 8.0.22中添加的。

  • -DWITH_TCMALLOC=bool

    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中添加的。

  • -DWITH_TEST_TRACE_PLUGIN=bool

    Whether to build the test protocol trace client plugin (see Using the Test Protocol Trace Plugin). By default, this option is disabled. Enabling this option has no effect unless the WITH_CLIENT_PROTOCOL_TRACING option is enabled. If MySQL is configured with both options enabled, the libmysqlclient client library is built with the test protocol trace plugin built in, and all the standard MySQL clients load the plugin. However, even when the test plugin is enabled, it has no effect by default. Control over the plugin is afforded using environment variables; see Using the Test Protocol Trace Plugin.使用环境变量提供对插件的控制;请参阅使用测试协议跟踪插件

    Note注意

    Do not enable the WITH_TEST_TRACE_PLUGIN option if you want to use your own protocol trace plugins because only one such plugin can be loaded at a time and an error occurs for attempts to load a second one. 如果您想使用自己的协议跟踪插件,请不要启用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.有关编写跟踪插件的信息,请参阅编写协议跟踪插件

  • -DWITH_TSAN=bool

    Whether to enable the ThreadSanitizer, for compilers that support it. The default is off.对于支持ThreadManitizer的编译器,是否启用它。默认为关闭。

  • -DWITH_UBSAN=bool

    Whether to enable the Undefined Behavior Sanitizer, for compilers that support it. The default is off.是否为支持Undefined Behavior Sanitizer的编译器启用它。默认为OFF

  • -DWITH_UNIT_TESTS={ON|OFF}

    If enabled, compile MySQL with unit tests. The default is ON unless the server is not being compiled.如果启用,请使用单元测试编译MySQL。除非未编译服务器,否则默认值为ON

  • -DWITH_UNIXODBC=1

    Enables unixODBC support, for Connector/ODBC.为连接器/ODBC启用unixODBC支持。

  • -DWITH_VALGRIND=bool

    Whether to compile in the Valgrind header files, which exposes the Valgrind API to MySQL code. The default is OFF.是否在Valgrind头文件中编译,这将Valgrind API暴露给MySQL代码。默认值为OFF

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

  • -DWITH_ZLIB=zlib_type

    Some features require that the server be built with compression library support, such as the COMPRESS() and UNCOMPRESS() functions, and compression of the client/server protocol. 一些功能要求服务器构建时支持压缩库,例如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.

  • -DWITH_ZSTD=zstd_type

    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中添加的。

Compiler Flags编译器标志

  • -DCMAKE_C_FLAGS="flags"

    Flags for the C Compiler.C编译器的标志。

  • -DCMAKE_CXX_FLAGS="flags"

    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中的标志。

    Note注意

    All optimization flags were carefully chosen and tested by the MySQL build team. Overriding them can lead to unexpected results and is done at your own risk.所有优化标志都经过MySQL构建团队的精心选择和测试。超越它们可能会导致意想不到的结果,而且风险自负。

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.要指定自己的C和C++编译器标志,对于不影响优化的标志,请使用CMAKE_C_FLAGSCMAKE_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 (-Onumber), you must set the CMAKE_C_FLAGS_build_type and/or CMAKE_CXX_FLAGS_build_type options, where build_type corresponds to the CMAKE_BUILD_TYPE value. To specify a different optimization for the default build type (RelWithDebInfo) set the CMAKE_C_FLAGS_RELWITHDEBINFO and CMAKE_CXX_FLAGS_RELWITHDEBINFO options. For example, to compile on Linux with -O3 and with debug symbols, do this:

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

CMake Options for Compiling NDB Cluster编译NDB集群的CMake选项

The following options are for use when building MySQL 8.0 sources with NDB Cluster support.以下选项用于构建支持NDB集群的MySQL 8.0源代码。

  • -DMEMCACHED_HOME=dir_name

    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_utilities library and the header file engine_testapp.h.此安装中用于生成的文件包括memcached二进制文件、头文件和库,以及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

  • -DWITH_CLASSPATH=path

    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,则会忽略此选项。

  • -DWITH_ERROR_INSERT={ON|OFF}

    Enables error injection in the NDB kernel. For testing only; not intended for use in building production binaries. The default is OFF.启用NDB内核中的错误注入。仅用于测试;不用于构建生产二进制文件。默认值为OFF

  • -DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}

    This is an alias for WITH_NDBCLUSTER.这是WITH_NDBCLUSTER的别名。

  • -DWITH_NDBCLUSTER={ON|OFF}

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

  • -DWITH_NDBMTD={ON|OFF}

    Build the multithreaded data node executable ndbmtd. The default is ON.

  • -DWITH_NDB_BINLOG={ON|OFF}

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

  • -DWITH_NDB_DEBUG={ON|OFF}

    Enable building the debug versions of the NDB Cluster binaries. OFF by default.启用构建NDB群集二进制文件的调试版本。默认情况下为OFF

  • -DWITH_NDB_JAVA={ON|OFF}

    Enable building NDB Cluster with Java support, including ClusterJ.支持构建具有Java支持的NDB集群,包括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. 默认情况下,此选项为ON。如果不希望使用Java支持编译NDB Cluster,则必须在运行CMake时通过指定-DWITH_NDB_Java=OFF来显式禁用它。Otherwise, if Java cannot be found, configuration of the build fails.否则,若找不到Java,构建的配置就会失败。

  • -DWITH_NDB_PORT=port

    Causes the NDB Cluster management server (ndb_mgmd) that is built to use this port by default. 默认情况下,使生成的NDB群集管理服务器(NDB_mgmd)使用此portIf this option is unset, the resulting management server tries to use port 1186 by default.如果未设置此选项,则默认情况下,生成的管理服务器会尝试使用端口1186。

  • -DWITH_NDB_TEST={ON|OFF}

    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的别名。