CMake 程序提供了对如何配置 MySQL 源分发的大量控制。通常,您可以使用 CMake 命令行上的选项来执行此操作。有关 CMake 支持的选项的信息,请在顶级源目录中运行以下命令之一:The CMake program provides a great deal of control over how you configure a MySQL source distribution. Typically, you do this using options on the CMake command line. For information about options supported by CMake, run either of these commands in the top-level source directory:
$>cmake . -LH$>ccmake .
您还可以使用某些环境变量影响 CMake。请参阅第 6.9 节“环境变量”。You can also affect CMake using certain environment variables. See Section 6.9, “Environment Variables”.
对于布尔选项,可以将值指定为 1 或 ON 以启用该选项,或者指定为 0 或 OFF禁用该选项。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.
许多选项用于配置编译时的默认值,这些默认值可以在服务器启动时被覆盖。例如,CMAKE_INSTALL_PREFIX,
MYSQL_TCP_PORT,以及MYSQL_UNIX_ADDR用于配置默认安装基础目录位置、TCP/IP 端口号和 Unix 套接字文件的选项可以在服务器启动时通过--basedir,
--port,以及--socket选项进行更改。mysqld在适用情况下,配置选项描述会指明对应的mysqld启动选项。Many options configure compile-time defaults that can be
overridden at server startup. For example, the
CMAKE_INSTALL_PREFIX,
MYSQL_TCP_PORT, and
MYSQL_UNIX_ADDR options that
configure the default installation base directory location, TCP/IP
port number, and Unix socket file can be changed at server startup
with the --basedir,
--port, and
--socket options for
mysqld. Where applicable, configuration option
descriptions indicate the corresponding mysqld
startup option.
以下部分提供有关 CMake 选项的更多信息。The following sections provide more information about CMake options.
下表显示了可用的 CMake 选项。在 Default 列中,PREFIX 代表 CMAKE_INSTALL_PREFIX 选项的值,该选项指定安装基目录。该值用作多个安装子目录的父位置。The following table shows the available CMake
options. In the Default column,
PREFIX stands for the value of the
CMAKE_INSTALL_PREFIX option, which
specifies the installation base directory. This value is used as
the parent location for several of the installation
subdirectories.
表 2.15 MySQL 源配置选项参考 (CMake)Table 2.15 MySQL Source-Configuration Option Reference (CMake)
| 格式Formats | 说明Description | 默认Default |
|---|---|---|
ADD_GDB_INDEXADD_GDB_INDEX |
是否启用在二进制文件中生成 .gdb_index 部分Whether to enable generation of .gdb_index section in binaries | |
BUILD_CONFIGBUILD_CONFIG |
使用与正式版本相同的构建选项Use same build options as official releases | |
BUNDLE_RUNTIME_LIBRARIESBUNDLE_RUNTIME_LIBRARIES |
将运行时库与适用于 Windows 的服务器 MSI 和 Zip 包捆绑在一起Bundle runtime libraries with server MSI and Zip packages for Windows | OFFOFF |
CMAKE_BUILD_TYPECMAKE_BUILD_TYPE |
要生成的构建类型Type of build to produce | RelWithDebInfoRelWithDebInfo |
CMAKE_CXX_FLAGSCMAKE_CXX_FLAGS |
C++ 编译器的标志Flags for C++ Compiler | |
CMAKE_C_FLAGSCMAKE_C_FLAGS |
C 编译器的标志Flags for C Compiler | |
CMAKE_INSTALL_PREFIXCMAKE_INSTALL_PREFIX |
安装基目录Installation base directory | /usr/local/mysql/usr/local/mysql |
COMPILATION_COMMENTCOMPILATION_COMMENT |
编译环境注释Comment about compilation environment | |
COMPILATION_COMMENT_SERVERCOMPILATION_COMMENT_SERVER |
有关 mysqld 使用的编译环境的注释Comment about compilation environment for use by mysqld | |
COMPRESS_DEBUG_SECTIONSCOMPRESS_DEBUG_SECTIONS |
压缩二进制文件的调试部分可执行文件Compress debug sections of binary executables | OFFOFF |
CPACK_MONOLITHIC_INSTALLCPACK_MONOLITHIC_INSTALL |
包构建是否生成单个文件Whether package build produces single file | OFFOFF |
DEFAULT_CHARSETDEFAULT_CHARSET |
默认服务器字符集The default server character set | utf8mb4utf8mb4 |
DEFAULT_COLLATIONDEFAULT_COLLATION |
默认服务器排序规则The default server collation | utf8mb4_0900_ai_ciutf8mb4_0900_ai_ci |
DISABLE_PSI_CONDDISABLE_PSI_COND |
排除性能架构条件检测Exclude Performance Schema condition instrumentation | OFFOFF |
DISABLE_PSI_DATA_LOCKDISABLE_PSI_DATA_LOCK |
排除性能架构数据锁定检测Exclude the performance schema data lock instrumentation | OFFOFF |
DISABLE_PSI_ERRORDISABLE_PSI_ERROR |
排除性能架构服务器错误检测Exclude the performance schema server error instrumentation | OFFOFF |
DISABLE_PSI_FILEDISABLE_PSI_FILE |
排除性能架构文件检测Exclude Performance Schema file instrumentation | OFFOFF |
DISABLE_PSI_IDLEDISABLE_PSI_IDLE |
排除性能架构空闲检测Exclude Performance Schema idle instrumentation | OFFOFF |
DISABLE_PSI_MEMORYDISABLE_PSI_MEMORY |
排除性能架构内存检测Exclude Performance Schema memory instrumentation | OFFOFF |
DISABLE_PSI_METADATADISABLE_PSI_METADATA |
排除性能架构元数据检测Exclude Performance Schema metadata instrumentation | OFFOFF |
DISABLE_PSI_MUTEXDISABLE_PSI_MUTEX |
排除性能架构互斥检测Exclude Performance Schema mutex instrumentation | OFFOFF |
DISABLE_PSI_PSDISABLE_PSI_PS |
排除性能架构准备好的语句Exclude the performance schema prepared statements | OFFOFF |
DISABLE_PSI_RWLOCKDISABLE_PSI_RWLOCK |
排除性能架构 rwlock 检测Exclude Performance Schema rwlock instrumentation | OFFOFF |
DISABLE_PSI_SOCKETDISABLE_PSI_SOCKET |
排除性能架构套接字检测Exclude Performance Schema socket instrumentation | OFFOFF |
DISABLE_PSI_SPDISABLE_PSI_SP |
排除性能架构存储程序检测Exclude Performance Schema stored program instrumentation | OFFOFF |
DISABLE_PSI_STAGEDISABLE_PSI_STAGE |
排除性能架构阶段检测Exclude Performance Schema stage instrumentation | OFFOFF |
DISABLE_PSI_STATEMENTDISABLE_PSI_STATEMENT |
排除性能架构语句检测Exclude Performance Schema statement instrumentation | OFFOFF |
DISABLE_PSI_STATEMENT_DIGESTDISABLE_PSI_STATEMENT_DIGEST |
排除性能架构 statements_digest 检测Exclude Performance Schema statements_digest instrumentation | OFFOFF |
DISABLE_PSI_TABLEDISABLE_PSI_TABLE |
排除性能架构表检测Exclude Performance Schema table instrumentation | OFFOFF |
DISABLE_PSI_THREADDISABLE_PSI_THREAD |
排除性能架构线程检测Exclude the performance schema thread instrumentation | OFFOFF |
DISABLE_PSI_TRANSACTIONDISABLE_PSI_TRANSACTION |
排除性能架构事务检测Exclude the performance schema transaction instrumentation | OFFOFF |
ENABLED_LOCAL_INFILEENABLED_LOCAL_INFILE |
是否为 LOAD DATA 启用 LOCALWhether to enable LOCAL for LOAD DATA | OFFOFF |
ENABLED_PROFILINGENABLED_PROFILING |
是否启用查询分析代码Whether to enable query profiling code | ONON |
ENABLE_EXPERIMENTAL_SYSVARSENABLE_EXPERIMENTAL_SYSVARS |
是否启用实验性 InnoDB 系统变量Whether to enabled experimental InnoDB system variables | OFFOFF |
ENABLE_GCOVENABLE_GCOV |
是否包含 gcov 支持Whether to include gcov support | |
ENABLE_GPROFENABLE_GPROF |
启用 gprof(仅限优化的 Linux 版本)Enable gprof (optimized Linux builds only) | OFFOFF |
FORCE_COLORED_OUTPUTFORCE_COLORED_OUTPUT |
是否对编译器输出进行着色Whether to colorize compiler output | OFFOFF |
FORCE_INSOURCE_BUILDFORCE_INSOURCE_BUILD |
是否强制进行源内构建Whether to force an in-source build | OFFOFF |
FORCE_UNSUPPORTED_COMPILERFORCE_UNSUPPORTED_COMPILER |
是否允许不支持的编译器编译器Whether to permit unsupported compilers | OFFOFF |
FPROFILE_GENERATEFPROFILE_GENERATE |
是否生成配置文件引导优化数据Whether to generate profile guided optimization data | OFFOFF |
FPROFILE_USEFPROFILE_USE |
是否使用配置文件引导优化数据Whether to use profile guided optimization data | OFFOFF |
HAVE_PSI_MEMORY_INTERFACEHAVE_PSI_MEMORY_INTERFACE |
为动态存储中使用的内存分配函数启用性能架构内存跟踪模块过度对齐的类型Enable performance schema memory tracing module for memory allocation functions used in dynamic storage of over-aligned types | OFFOFF |
IGNORE_AIO_CHECKIGNORE_AIO_CHECK |
使用-DBUILD_CONFIG=mysql_release,忽略 libaio 检查With -DBUILD_CONFIG=mysql_release, ignore libaio check | OFFOFF |
INSTALL_BINDIRINSTALL_BINDIR |
用户可执行文件目录User executables directory | PREFIX/binPREFIX/bin |
INSTALL_DOCDIRINSTALL_DOCDIR |
文档目录Documentation directory | PREFIX/docsPREFIX/docs |
INSTALL_DOCREADMEDIRINSTALL_DOCREADMEDIR |
自述文件目录README file directory | PREFIXPREFIX |
INSTALL_INCLUDEDIRINSTALL_INCLUDEDIR |
头文件目录Header file directory | PREFIX/includePREFIX/include |
INSTALL_INFODIRINSTALL_INFODIR |
信息文件目录Info file directory | PREFIX/docsPREFIX/docs |
INSTALL_LAYOUTINSTALL_LAYOUT |
选择预定义安装布局Select predefined installation layout | STANDALONESTANDALONE |
INSTALL_LIBDIRINSTALL_LIBDIR |
库文件目录Library file directory | PREFIX/libPREFIX/lib |
INSTALL_MANDIRINSTALL_MANDIR |
手册页目录Manual page directory | PREFIX/manPREFIX/man |
INSTALL_MYSQLSHAREDIRINSTALL_MYSQLSHAREDIR |
共享数据目录Shared data directory | PREFIX/sharePREFIX/share |
INSTALL_MYSQLTESTDIRINSTALL_MYSQLTESTDIR |
mysql-test 目录mysql-test directory | PREFIX/mysql-testPREFIX/mysql-test |
INSTALL_PKGCONFIGDIRINSTALL_PKGCONFIGDIR |
mysqlclient.pc pkg-config 文件的目录Directory for mysqlclient.pc pkg-config file | INSTALL_LIBDIR/pkgconfigINSTALL_LIBDIR/pkgconfig |
INSTALL_PLUGINDIRINSTALL_PLUGINDIR |
插件目录Plugin directory | PREFIX/lib/pluginPREFIX/lib/plugin |
INSTALL_PRIV_LIBDIRINSTALL_PRIV_LIBDIR |
安装私有库目录Installation private library directory | |
INSTALL_SBINDIRINSTALL_SBINDIR |
服务器可执行目录Server executable directory | PREFIX/binPREFIX/bin |
INSTALL_SECURE_FILE_PRIVDIRINSTALL_SECURE_FILE_PRIVDIR |
secure_file_priv 默认值secure_file_priv default value | platform specificplatform specific |
INSTALL_SHAREDIRINSTALL_SHAREDIR |
aclocal/mysql.m4 安装目录aclocal/mysql.m4 installation directory | PREFIX/sharePREFIX/share |
INSTALL_STATIC_LIBRARIESINSTALL_STATIC_LIBRARIES |
是否安装静态库Whether to install static libraries | ONON |
INSTALL_SUPPORTFILESDIRINSTALL_SUPPORTFILESDIR |
额外支持文件目录Extra support files directory | PREFIX/support-filesPREFIX/support-files |
LINK_RANDOMIZELINK_RANDOMIZE |
是否随机化 mysqld 二进制文件中符号的顺序Whether to randomize order of symbols in mysqld binary | OFFOFF |
LINK_RANDOMIZE_SEEDLINK_RANDOMIZE_SEED |
LINK_RANDOMIZE 选项的种子值Seed value for LINK_RANDOMIZE option | mysqlmysql |
MAX_INDEXESMAX_INDEXES |
每个表的最大索引Maximum indexes per table | 64 |
MSVC_CPPCHECKMSVC_CPPCHECK |
启用 MSVC 代码分析。Enable MSVC code analysis. | ONON |
MUTEX_TYPEMUTEX_TYPE |
InnoDB 互斥体类型InnoDB mutex type | eventevent |
MYSQLX_TCP_PORTMYSQLX_TCP_PORT |
X 使用的 TCP/IP 端口号插件TCP/IP port number used by X Plugin | 33060 |
MYSQLX_UNIX_ADDRMYSQLX_UNIX_ADDR |
X 插件使用的 Unix 套接字文件Unix socket file used by X Plugin | /tmp/mysqlx.sock/tmp/mysqlx.sock |
MYSQL_DATADIRMYSQL_DATADIR |
数据目录Data directory | |
MYSQL_MAINTAINER_MODEMYSQL_MAINTAINER_MODE |
是否启用 MySQL 维护者特定开发环境Whether to enable MySQL maintainer-specific development environment | OFFOFF |
MYSQL_PROJECT_NAMEMYSQL_PROJECT_NAME |
Windows/macOS 项目名称Windows/macOS project name | MySQLMySQL |
MYSQL_TCP_PORTMYSQL_TCP_PORT |
TCP/IP 端口号TCP/IP port number | 3306 |
MYSQL_UNIX_ADDRMYSQL_UNIX_ADDR |
Unix 套接字文件Unix socket file | /tmp/mysql.sock/tmp/mysql.sock |
NDB_UTILS_LINK_DYNAMICNDB_UTILS_LINK_DYNAMIC |
使 NDB 工具动态链接到 ndbclientCause NDB tools to be dynamically linked to ndbclient | |
ODBC_INCLUDESODBC_INCLUDES |
ODBC 包含目录ODBC includes directory | |
ODBC_LIB_DIRODBC_LIB_DIR |
ODBC 库目录ODBC library directory | |
OPTIMIZER_TRACEOPTIMIZER_TRACE |
是否支持优化器跟踪Whether to support optimizer tracing | |
OPTIMIZE_SANITIZER_BUILDSOPTIMIZE_SANITIZER_BUILDS |
是否优化消毒剂构建Whether to optimize sanitizer builds | ONON |
REPRODUCIBLE_BUILDREPRODUCIBLE_BUILD |
要格外小心地创建独立于构建位置和 timeTake extra care to create a build result independent of build location and time | |
SHOW_SUPPRESSED_COMPILER_WARNINGSHOW_SUPPRESSED_COMPILER_WARNING |
是否显示抑制的编译器警告且不会因 -Werror 失败。Whether to show suppressed compiler warnings and not fail with -Werror. | OFFOFF |
SYSCONFDIRSYSCONFDIR |
选项文件目录Option file directory | |
SYSTEMD_PID_DIRSYSTEMD_PID_DIR |
systemd 下 PID 文件的目录Directory for PID file under systemd | /var/run/mysqld/var/run/mysqld |
SYSTEMD_SERVICE_NAMESYSTEMD_SERVICE_NAME |
systemd 下的 MySQL 服务名称Name of MySQL service under systemd | mysqldmysqld |
TMPDIRTMPDIR |
tmpdir 默认值tmpdir default value | |
WIN_DEBUG_NO_INLINEWIN_DEBUG_NO_INLINE |
是否禁用函数内联Whether to disable function inlining | OFFOFF |
WITHOUT_SERVERWITHOUT_SERVER |
不构建服务器;仅供内部使用Do not build the server; internal use only | OFFOFF |
WITHOUT_xxx_STORAGE_ENGINEWITHOUT_xxx_STORAGE_ENGINE |
从构建中排除存储引擎 xxxExclude storage engine xxx from build | |
WITH_ANTWITH_ANT |
用于构建 GCS Java 包装器的 Ant 路径Path to Ant for building GCS Java wrapper | |
WITH_ASANWITH_ASAN |
启用 AddressSanitizerEnable AddressSanitizer | OFFOFF |
WITH_ASAN_SCOPEWITH_ASAN_SCOPE |
启用 AddressSanitizer -fsanitize-address-use-after-scope Clang 标志Enable AddressSanitizer -fsanitize-address-use-after-scope Clang flag | OFFOFF |
WITH_AUTHENTICATION_CLIENT_PLUGINSWITH_AUTHENTICATION_CLIENT_PLUGINS |
如果构建了任何相应的服务器身份验证插件,则自动启用Enabled automatically if any corresponding server authentication plugins are built | |
WITH_AUTHENTICATION_LDAPWITH_AUTHENTICATION_LDAP |
无法构建 LDAP 认证插件是否报错Whether to report error if LDAP authentication plugins cannot be built | OFFOFF |
WITH_AUTHENTICATION_PAMWITH_AUTHENTICATION_PAM |
构建 PAM 认证插件Build PAM authentication plugin | OFFOFF |
WITH_AWS_SDKWITH_AWS_SDK |
Amazon Web Services 软件开发工具包的位置Location of Amazon Web Services software development kit | |
WITH_BUILD_IDWITH_BUILD_ID |
在 Linux 系统上,生成唯一的构建 IDOn Linux systems, generate a unique build ID | ONON |
WITH_CLASSPATHWITH_CLASSPATH |
构建适用于 Java 的 MySQL 集群连接器时使用的类路径。默认为空字符串。Classpath to use when building MySQL Cluster Connector for Java. Default is an empty string. | |
WITH_CLIENT_PROTOCOL_TRACINGWITH_CLIENT_PROTOCOL_TRACING |
构建客户端协议跟踪框架Build client-side protocol tracing framework | ONON |
WITH_CURLWITH_CURL |
curl 库的位置Location of curl library | |
WITH_DEBUGWITH_DEBUG |
是否包含调试支持Whether to include debugging support | OFFOFF |
WITH_DEFAULT_COMPILER_OPTIONSWITH_DEFAULT_COMPILER_OPTIONS |
是否使用默认编译器 optionsWhether to use default compiler options | ONON |
WITH_DEVELOPER_ENTITLEMENTSWITH_DEVELOPER_ENTITLEMENTS |
是否向 macOS 上的所有可执行文件添加“get-task-allow”权限,以便在服务器意外停止时生成核心转储Whether to add the 'get-task-allow' entitlement to all executables on macOS to generate a core dump in the event of an unexpected server halt | OFFOFF |
WITH_EDITLINEWITH_EDITLINE |
使用哪个 libedit/editline 库Which libedit/editline library to use | bundledbundled |
WITH_ERROR_INSERTWITH_ERROR_INSERT |
在 NDB 存储引擎中启用错误注入。不应用于构建用于生产的二进制文件。Enable error injection in the NDB storage engine. Should not be used for building binaries intended for production. | OFFOFF |
WITH_ICUWITH_ICU |
ICU 支持类型Type of ICU support | bundledbundled |
WITH_INNODB_EXTRA_DEBUGWITH_INNODB_EXTRA_DEBUG |
是否包含对 InnoDB 的额外调试支持。Whether to include extra debugging support for InnoDB. | OFFOFF |
WITH_JEMALLOCWITH_JEMALLOC |
是否链接-ljemallocWhether to link with -ljemalloc | OFFOFF |
WITH_LDWITH_LD |
是否使用 LLVM lld 或 mold 链接器Whether to use the LLVM lld or mold linker | |
WITH_LIBEVENTWITH_LIBEVENT |
使用哪个 libevent 库Which libevent library to use | bundledbundled |
WITH_LIBWRAPWITH_LIBWRAP |
是否包含 libwrap(TCP 包装器)支持Whether to include libwrap (TCP wrappers) support | OFFOFF |
WITH_LOCK_ORDERWITH_LOCK_ORDER |
是否启用 LOCK_ORDER 工具Whether to enable LOCK_ORDER tooling | OFFOFF |
WITH_LSANWITH_LSAN |
是否运行 LeakSanitizer,不运行 AddressSanitizerWhether to run LeakSanitizer, without AddressSanitizer | OFFOFF |
WITH_LTOWITH_LTO |
启用链接时优化器Enable link-time optimizer | OFFOFF |
WITH_LZ4WITH_LZ4 |
LZ4 库支持类型Type of LZ4 library support | bundledbundled |
WITH_MECABWITH_MECAB |
编译梅卡布Compiles MeCab | |
WITH_MSANWITH_MSAN |
启用 MemorySanitizerEnable MemorySanitizer | OFFOFF |
WITH_MSCRT_DEBUGWITH_MSCRT_DEBUG |
启用 Visual Studio CRT 内存泄漏跟踪Enable Visual Studio CRT memory leak tracing | OFFOFF |
WITH_MYSQLXWITH_MYSQLX |
是否禁用 X 协议Whether to disable X Protocol | ONON |
WITH_NDBWITH_NDB |
构建 MySQL NDB Cluster,包括 NDB 存储引擎和所有 NDB 程序Build MySQL NDB Cluster, including NDB storage engine and all NDB programs | OFFOFF |
WITH_NDBAPI_EXAMPLESWITH_NDBAPI_EXAMPLES |
构建 API 示例程序。Build API example programs. | OFFOFF |
WITH_NDBCLUSTERWITH_NDBCLUSTER |
NDB 8.0.30 及更早版本:构建 NDB 存储引擎。 NDB 8.0.31 及更高版本:已弃用;使用 WITH_NDB 代替NDB 8.0.30 and earlier: Build NDB storage engine. NDB 8.0.31 and later: Deprecated; use WITH_NDB instead | OFFOFF |
WITH_NDBCLUSTER_STORAGE_ENGINEWITH_NDBCLUSTER_STORAGE_ENGINE |
在 NDB 8.0.31 之前,这仅供内部使用。 NDB 8.0.31 及更高版本:切换(仅)包含 NDBCLUSTER 存储引擎Prior to NDB 8.0.31, this was for internal use only. NDB 8.0.31 and later: toggles (only) inclusion of NDBCLUSTER storage engine | ONON |
WITH_NDBMTDWITH_NDBMTD |
构建多线程数据节点二进制文件Build multithreaded data node binary | ONON |
WITH_NDB_DEBUGWITH_NDB_DEBUG |
生成用于测试或故障排除的调试版本。Produce a debug build for testing or troubleshooting. | OFFOFF |
WITH_NDB_JAVAWITH_NDB_JAVA |
启用 Java 和 ClusterJ 支持的构建。默认启用。仅在 MySQL 集群中受支持。Enable building of Java and ClusterJ support. Enabled by default. Supported in MySQL Cluster only. | ONON |
WITH_NDB_PORTWITH_NDB_PORT |
使用此选项构建的管理服务器使用的默认端口。如果未使用此选项来构建它,则管理服务器的默认端口为 1186。Default port used by a management server built with this option. If this option was not used to build it, the management server's default port is 1186. | [none][none] |
WITH_NDB_TESTWITH_NDB_TEST |
包括 NDB API 测试Include NDB API test programs. | OFFOFF |
WITH_NDB_TLS_SEARCH_PATHWITH_NDB_TLS_SEARCH_PATH |
NDB 程序用于搜索 TLS 证书和密钥文件的默认路径。Default path used by NDB programs to search for TLS certificate and key files. | $HOME/ndb-tls$HOME/ndb-tls |
WITH_NUMAWITH_NUMA |
设置 NUMA 内存分配策略Set NUMA memory allocation policy | |
WITH_PACKAGE_FLAGSWITH_PACKAGE_FLAGS |
对于通常用于 RPM/DEB 包的标志,是否将它们添加到这些平台上的独立构建For flags typically used for RPM/DEB packages, whether to add them to standalone builds on those platforms | |
WITH_PROTOBUFWITH_PROTOBUF |
要使用的 Protocol Buffers 包Which Protocol Buffers package to use | bundledbundled |
WITH_RAPIDWITH_RAPID |
是否构建快速开发周期插件Whether to build rapid development cycle plugins | ONON |
WITH_RAPIDJSONWITH_RAPIDJSON |
RapidJSON 支持类型Type of RapidJSON support | bundledbundled |
WITH_ROUTERWITH_ROUTER |
是否构建 MySQL RouterWhether to build MySQL Router | ONON |
WITH_SASLWITH_SASL |
内部使用仅Internal use only | |
WITH_SHOW_PARSE_TREEWITH_SHOW_PARSE_TREE |
支持 SHOW PARSE_TREE 调试语句Support for SHOW PARSE_TREE debugging statement | |
WITH_SSLWITH_SSL |
SSL 支持类型Type of SSL support | systemsystem |
WITH_SYSTEMDWITH_SYSTEMD |
启用 systemd 支持文件的安装Enable installation of systemd support files | OFFOFF |
WITH_SYSTEMD_DEBUGWITH_SYSTEMD_DEBUG |
启用其他 systemd 调试信息Enable additional systemd debug information | OFFOFF |
WITH_SYSTEM_LIBSWITH_SYSTEM_LIBS |
设置未明确设置的库选项的系统值Set system value of library options not set explicitly | OFFOFF |
WITH_TCMALLOCWITH_TCMALLOC |
是否与-ltcmalloc 链接。 BUNDLED 仅在 Linux 上受支持Whether to link with -ltcmalloc. BUNDLED is supported on Linux only | OFFOFF |
WITH_TEST_TRACE_PLUGINWITH_TEST_TRACE_PLUGIN |
构建测试协议跟踪插件Build test protocol trace plugin | OFFOFF |
WITH_TSANWITH_TSAN |
启用 ThreadSanitizerEnable ThreadSanitizer | OFFOFF |
WITH_UBSANWITH_UBSAN |
启用未定义行为 SanitizerEnable Undefined Behavior Sanitizer | OFFOFF |
WITH_UNIT_TESTSWITH_UNIT_TESTS |
使用单元测试编译 MySQLCompile MySQL with unit tests | ONON |
WITH_UNIXODBCWITH_UNIXODBC |
启用 unixODBC 支持Enable unixODBC support | OFFOFF |
WITH_VALGRINDWITH_VALGRIND |
是否在 Valgrind 头文件中编译Whether to compile in Valgrind header files | OFFOFF |
WITH_WIN_JEMALLOCWITH_WIN_JEMALLOC |
包含 jemalloc.dll 的目录路径Path to directory containing jemalloc.dll | |
WITH_ZLIBWITH_ZLIB |
zlib 支持类型Type of zlib support | bundledbundled |
WITH_ZSTDWITH_ZSTD |
zstd 支持类型Type of zstd support | bundledbundled |
WITH_xxx_STORAGE_ENGINEWITH_xxx_STORAGE_ENGINE |
将存储引擎 xxx 静态编译为 serverCompile storage engine xxx statically into server |
-DBUILD_CONFIG=mysql_release-DBUILD_CONFIG=mysql_release此选项使用所使用的相同构建选项配置源发行版由 Oracle 为官方 MySQL 版本生成二进制发行版。This option configures a source distribution with the same build options used by Oracle to produce binary distributions for official MySQL releases.
-DWITH_BUILD_ID=bool-DWITH_BUILD_ID=bool在 Linux 系统上,生成一个唯一的构建 ID,该 ID 用作
build_id系统变量的值,并在启动时写入 MySQL 服务器日志。将此选项设置为OFF可禁用此功能。On Linux systems, generates a unique build ID which is used as the value of thebuild_idsystem variable and written to the MySQL server log on startup. Set this option toOFFto disable this feature.此选项对 Linux 以外的平台没有影响。This option has no effect on platforms other than Linux.
-DBUNDLE_RUNTIME_LIBRARIES=bool-DBUNDLE_RUNTIME_LIBRARIES=bool是否将运行时库与 Windows 的服务器 MSI 和 Zip 包捆绑在一起。Whether to bundle runtime libraries with server MSI and Zip packages for Windows.
-DCMAKE_BUILD_TYPE=type-DCMAKE_BUILD_TYPE=type要生成的构建类型:The type of build to produce:
RelWithDebInfo:启用优化并生成调试信息。这是默认的 MySQL 构建类型。RelWithDebInfo: Enable optimizations and generate debugging information. This is the default MySQL build type.Release:启用优化但忽略调试信息以减少构建大小。Release: Enable optimizations but omit debugging information to reduce the build size.Debug:禁用优化并生成调试信息。如果启用了WITH_DEBUG选项,也会使用此构建类型。也就是说,-DWITH_DEBUG=1与-DCMAKE_BUILD_TYPE=Debug。Debug: Disable optimizations and generate debugging information. This build type is also used if theWITH_DEBUGoption is enabled. That is,-DWITH_DEBUG=1has the same effect as-DCMAKE_BUILD_TYPE=Debug.
不支持选项值
None和MinSizeRel。The option valuesNoneandMinSizeRelare not supported.-DCPACK_MONOLITHIC_INSTALL=bool-DCPACK_MONOLITHIC_INSTALL=bool此选项影响make package操作是生成多个安装包文件还是单个文件。如果禁用,该操作会生成多个安装包文件,如果您只想安装完整 MySQL 安装的子集,这可能很有用。如果启用,它会生成一个文件来安装所有内容。This option affects whether the make package operation produces multiple installation package files or a single file. If disabled, the operation produces multiple installation package files, which may be useful if you want to install only a subset of a full MySQL installation. If enabled, it produces a single file for installing everything.
-DFORCE_INSOURCE_BUILD=bool-DFORCE_INSOURCE_BUILD=bool定义是否强制进行源内构建。建议使用源外构建,因为它们允许来自同一源的多个构建,并且可以通过删除构建目录来快速执行清理。要强制进行源内构建,请使用
-DFORCE_INSOURCE_BUILD=ON调用 CMake。Defines whether to force an in-source build. Out-of-source builds are recommended, as they permit multiple builds from the same source, and cleanup can be performed quickly by removing the build directory. To force an in-source build, invoke CMake with-DFORCE_INSOURCE_BUILD=ON.-DFORCE_COLORED_OUTPUT=bool-DFORCE_COLORED_OUTPUT=bool定义是否为 gcc 和 clang 在命令行上编译时。默认为
OFF。Defines whether to enable colorized compiler output for gcc and clang when compiling on the command line. Defaults toOFF.
CMAKE_INSTALL_PREFIX 选项指示基本安装目录。其他名称格式为 INSTALL_ 的选项指示组件位置相对于前缀进行解释,并且它们的值是相对路径名。它们的值不应包含前缀。The xxxCMAKE_INSTALL_PREFIX option
indicates the base installation directory. Other options with
names of the form
INSTALL_ that
indicate component locations are interpreted relative to the
prefix and their values are relative pathnames. Their values
should not include the prefix.xxx
-DCMAKE_INSTALL_PREFIX=dir_name-DCMAKE_INSTALL_PREFIX=dir_name安装基目录。The installation base directory.
可以在服务器启动时使用
--basedir选项设置该值。This value can be set at server startup using the--basediroption.-DINSTALL_BINDIR=dir_name-DINSTALL_BINDIR=dir_name安装用户程序的位置。Where to install user programs.
-DINSTALL_DOCDIR=dir_name-DINSTALL_DOCDIR=dir_name安装文档的位置。Where to install documentation.
-DINSTALL_DOCREADMEDIR=dir_name-DINSTALL_DOCREADMEDIR=dir_nameREADME文件的安装位置。Where to installREADMEfiles.-DINSTALL_INCLUDEDIR=dir_name-DINSTALL_INCLUDEDIR=dir_name安装头文件的位置。Where to install header files.
-DINSTALL_INFODIR=dir_name-DINSTALL_INFODIR=dir_name信息文件的安装位置。Where to install Info files.
-DINSTALL_LAYOUT=name-DINSTALL_LAYOUT=name选择预定义的安装布局:Select a predefined installation layout:
STANDALONE:与.tar.gz和.zip软件包使用的布局相同。这是默认值。STANDALONE: Same layout as used for.tar.gzand.zippackages. This is the default.RPM:与 RPM 软件包类似的布局。RPM: Layout similar to RPM packages.SVR4:Solaris 软件包布局。SVR4: Solaris package layout.DEB:DEB 软件包布局(实验性)。DEB: DEB package layout (experimental).
您可以选择预定义的布局,但可以通过指定其他选项来修改各个组件的安装位置。例如:You can select a predefined layout but modify individual component installation locations by specifying other options. For example:
cmake . -DINSTALL_LAYOUT=SVR4 -DMYSQL_DATADIR=/var/mysql/data
INSTALL_LAYOUT值确定secure_file_priv系统变量的默认值。请参阅第 7.1.8 节“服务器系统变量”中对此变量的说明。TheINSTALL_LAYOUTvalue determines the default value of thesecure_file_privsystem variable. See the description of this variable in Section 7.1.8, “Server System Variables”.-DINSTALL_LIBDIR=dir_name-DINSTALL_LIBDIR=dir_name安装库文件的位置。Where to install library files.
-DINSTALL_MANDIR=dir_name-DINSTALL_MANDIR=dir_name安装手册页的位置。Where to install manual pages.
-DINSTALL_MYSQLSHAREDIR=dir_name-DINSTALL_MYSQLSHAREDIR=dir_name安装共享数据文件的位置。Where to install shared data files.
-DINSTALL_MYSQLTESTDIR=dir_name-DINSTALL_MYSQLTESTDIR=dir_name安装
mysql-test目录的位置。要禁止安装此目录,请显式将该选项设置为空值 (-DINSTALL_MYSQLTESTDIR=)。Where to install themysql-testdirectory. To suppress installation of this directory, explicitly set the option to the empty value (-DINSTALL_MYSQLTESTDIR=).-DINSTALL_PKGCONFIGDIR=dir_name-DINSTALL_PKGCONFIGDIR=dir_name安装
mysqlclient.pc文件供 pkg-config 使用。默认值为INSTALL_LIBDIR/pkgconfig,除非INSTALL_LIBDIR以/mysql结尾,在这种情况下,首先将其删除。The directory in which to install themysqlclient.pcfile for use by pkg-config. The default value isINSTALL_LIBDIR/pkgconfig, unlessINSTALL_LIBDIRends with/mysql, in which case that is removed first.-DINSTALL_PLUGINDIR=dir_name-DINSTALL_PLUGINDIR=dir_name插件目录的位置。The location of the plugin directory.
可以在服务器启动时使用以下命令设置此值:
--plugin_dir选项。This value can be set at server startup with the--plugin_diroption.-DINSTALL_PRIV_LIBDIR=dir_name-DINSTALL_PRIV_LIBDIR=dir_name动态库目录的位置。The location of the dynamic library directory.
默认位置。 对于 RPM 构建,这是
/usr/lib64/mysql/private/,对于 DEB 来说是/usr/lib/mysql/private/,对于 TAR 来说是lib/private/。Default location. For RPM builds, this is/usr/lib64/mysql/private/, for DEB it is/usr/lib/mysql/private/, and for TAR it islib/private/.Protobuf。 由于这是私有位置,因此加载程序(例如 Linux 上的
ld-linux.so)可能无法在没有帮助的情况下找到libprotobuf.so文件。为了引导加载程序,将RPATH=$ORIGIN/../$INSTALL_PRIV_LIBDIR添加到 mysqld 和 mysqlxtest 中。这适用于大多数情况,但当使用 资源组 功能时,mysqld 是setsuid,并且加载器忽略任何包含$ORIGIN的RPATH。为了克服这个问题,在 mysqld 的 DEB 和 RPM 版本中设置了该目录的显式完整路径,因为目标目的地是已知的。对于 tarball 安装,需要使用 patchelf 等工具修补 mysqld。Protobuf. Because this is a private location, the loader (such asld-linux.soon Linux) may not find thelibprotobuf.sofiles without help. To guide the loader,RPATH=$ORIGIN/../$INSTALL_PRIV_LIBDIRis added to mysqld and mysqlxtest. This works for most cases but when using the Resource Group feature, mysqld issetsuid, and the loader ignores anyRPATHwhich contains$ORIGIN. To overcome this, an explicit full path to the directory is set in the DEB and RPM versions of mysqld, since the target destination is known. For tarball installs, patching of mysqld with a tool like patchelf is required.-DINSTALL_SBINDIR=dir_name-DINSTALL_SBINDIR=dir_name-DINSTALL_SECURE_FILE_PRIVDIR=dir_name-DINSTALL_SECURE_FILE_PRIVDIR=dir_namesecure_file_priv系统变量的默认值。默认值是特定于平台的,取决于INSTALL_LAYOUTCMake 选项的值;请参阅第 7.1.8 节“服务器系统变量”中对secure_file_priv系统变量的说明。The default value for thesecure_file_privsystem variable. The default value is platform specific and depends on the value of theINSTALL_LAYOUTCMake option; see the description of thesecure_file_privsystem variable in Section 7.1.8, “Server System Variables”.-DINSTALL_SHAREDIR=dir_name-DINSTALL_SHAREDIR=dir_name安装位置
aclocal/mysql.m4.Where to installaclocal/mysql.m4.-DINSTALL_STATIC_LIBRARIES=bool-DINSTALL_STATIC_LIBRARIES=bool是否安装静态库。默认值为
ON。如果设置为OFF,则不会安装这些库文件:libmysqlclient.a、libmysqlservices.a。Whether to install static libraries. The default isON. If set toOFF, these library files are not installed:libmysqlclient.a,libmysqlservices.a.-DINSTALL_SUPPORTFILESDIR=dir_name-DINSTALL_SUPPORTFILESDIR=dir_name安装额外支持文件的位置。Where to install extra support files.
-DLINK_RANDOMIZE=bool-DLINK_RANDOMIZE=bool是否随机化 mysqld 二进制文件中的符号顺序。默认值为
OFF。仅应出于调试目的启用此选项。Whether to randomize the order of symbols in the mysqld binary. The default isOFF. This option should be enabled only for debugging purposes.-DLINK_RANDOMIZE_SEED=val-DLINK_RANDOMIZE_SEED=valLINK_RANDOMIZE选项的种子值。该值是一个字符串。默认为mysql,任意选择。Seed value for theLINK_RANDOMIZEoption. The value is a string. The default ismysql, an arbitrary choice.-DMYSQL_DATADIR=dir_name-DMYSQL_DATADIR=dir_nameMySQL 数据目录的位置。The location of the MySQL data directory.
可以在服务器启动时使用
--datadir选项设置此值。This value can be set at server startup with the--datadiroption.-DODBC_INCLUDES=dir_name-DODBC_INCLUDES=dir_nameODBC 的位置包括目录,在配置时可以使用该目录连接器/ODBC。The location of the ODBC includes directory, which may be used while configuring Connector/ODBC.
-DODBC_LIB_DIR=dir_name-DODBC_LIB_DIR=dir_nameODBC 库目录的位置,其中可以在配置 Connector/ODBC 时使用。The location of the ODBC library directory, which may be used while configuring Connector/ODBC.
-DSYSCONFDIR=dir_name-DSYSCONFDIR=dir_name默认
my.cnf选项文件目录。The defaultmy.cnfoption file directory.此位置无法在服务器启动时设置,但您可以使用
--defaults-file=选项启动带有给定选项文件的服务器,其中file_namefile_name是文件的完整路径名。This location cannot be set at server startup, but you can start the server with a given option file using the--defaults-file=option, wherefile_namefile_nameis the full path name to the file.-DSYSTEMD_PID_DIR=dir_name-DSYSTEMD_PID_DIR=dir_nameMySQL 由 systemd 管理时在其中创建 PID 文件的目录名称。默认为
/var/run/mysqld;这可能会根据INSTALL_LAYOUT值隐式更改。The name of the directory in which to create the PID file when MySQL is managed by systemd. The default is/var/run/mysqld; this might be changed implicitly according to theINSTALL_LAYOUTvalue.此选项将被忽略,除非
WITH_SYSTEMDThis option is ignored unlessWITH_SYSTEMDis enabled.-DSYSTEMD_SERVICE_NAME=name-DSYSTEMD_SERVICE_NAME=nameMySQL 管理时使用的 MySQL 服务的名称systemd。默认为
mysqld;这可能会根据INSTALL_LAYOUT值隐式更改。The name of the MySQL service to use when MySQL is managed by systemd. The default ismysqld; this might be changed implicitly according to theINSTALL_LAYOUTvalue.此选项将被忽略,除非
WITH_SYSTEMDThis option is ignored unlessWITH_SYSTEMDis enabled.-DTMPDIR=dir_name-DTMPDIR=dir_name用于
tmpdir系统变量的默认位置。如果未指定,该值默认为P_tmpdir在<stdio.h>.The default location to use for thetmpdirsystem variable. If unspecified, the value defaults toP_tmpdirin<stdio.h>.
存储引擎是作为插件构建的。您可以将插件构建为静态模块(编译到服务器中)或动态模块(构建为动态库,必须使用 INSTALL PLUGIN 语句或 --plugin-load 选项才能使用)。某些插件可能不支持静态或动态构建。Storage engines are built as plugins. You can build a plugin as
a static module (compiled into the server) or a dynamic module
(built as a dynamic library that must be installed into the
server using the INSTALL PLUGIN
statement or the --plugin-load
option before it can be used). Some plugins might not support
static or dynamic building.
InnoDB、MyISAM、MERGE、MEMORY 和 CSV 引擎是必需的(始终编译到服务器中),无需显式安装。The InnoDB,
MyISAM,
MERGE,
MEMORY, and
CSV engines are mandatory (always
compiled into the server) and need not be installed explicitly.
要将存储引擎静态编译到服务器中,请使用 -DWITH_。一些允许的 engine_STORAGE_ENGINE=1engine 值包括 ARCHIVE、BLACKHOLE、EXAMPLE 和 FEDERATED。示例:To compile a storage engine statically into the server, use
-DWITH_.
Some permissible engine_STORAGE_ENGINE=1engine values are
ARCHIVE, BLACKHOLE,
EXAMPLE, and FEDERATED.
Examples:
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1
要构建支持 NDB Cluster 的 MySQL,请使用 WITH_NDB 选项。To build MySQL with support for NDB Cluster, use the
WITH_NDB option.
如果没有 Performance Schema 支持,则无法进行编译。如果希望在不使用特定类型检测的情况下进行编译,可以使用以下 CMake 选项来完成:It is not possible to compile without Performance Schema support. If it is desired to compile without particular types of instrumentation, that can be done with the following CMake options:
DISABLE_PSI_COND DISABLE_PSI_DATA_LOCK DISABLE_PSI_ERROR DISABLE_PSI_FILE DISABLE_PSI_IDLE DISABLE_PSI_MEMORY DISABLE_PSI_METADATA DISABLE_PSI_MUTEX DISABLE_PSI_PS DISABLE_PSI_RWLOCK DISABLE_PSI_SOCKET DISABLE_PSI_SP DISABLE_PSI_STAGE DISABLE_PSI_STATEMENT DISABLE_PSI_STATEMENT_DIGEST DISABLE_PSI_TABLE DISABLE_PSI_THREAD DISABLE_PSI_TRANSACTION
例如,要在不使用互斥检测的情况下进行编译,请使用 -DDISABLE_PSI_MUTEX=1。For example, to compile without mutex instrumentation,
configure MySQL using
-DDISABLE_PSI_MUTEX=1.
要从构建中排除存储引擎,请使用-DWITH_。示例:To exclude a storage engine from the build, use
engine_STORAGE_ENGINE=0-DWITH_.
Examples:engine_STORAGE_ENGINE=0
-DWITH_ARCHIVE_STORAGE_ENGINE=0 -DWITH_EXAMPLE_STORAGE_ENGINE=0 -DWITH_FEDERATED_STORAGE_ENGINE=0
还可以使用 -DWITHOUT_ 从构建中排除存储引擎(但首选 engine_STORAGE_ENGINE=1-DWITH_)。示例:It is also possible to exclude a storage engine from the build
using
engine_STORAGE_ENGINE=0-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
如果未为给定存储引擎指定 -DWITH_ 和 engine_STORAGE_ENGINE-DWITHOUT_,则该引擎将构建为共享模块,如果无法构建为共享模块,则将其排除模块。If neither
engine_STORAGE_ENGINE-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
-DADD_GDB_INDEX=bool-DADD_GDB_INDEX=bool此选项确定是否启用
.gdb_index部分,这使得在调试器中加载它们的速度更快。默认情况下该选项处于禁用状态。使用 lld 链接器,并通过以下方式禁用。如果使用 lld 或 GNU gold 以外的链接器,则无效。This option determines whether to enable generation of a.gdb_indexsection 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.-DCOMPILATION_COMMENT=string-DCOMPILATION_COMMENT=string有关编译环境的描述性注释。虽然 mysqld 使用
COMPILATION_COMMENT_SERVER,但其他程序使用COMPILATION_COMMENT。A descriptive comment about the compilation environment. While mysqld usesCOMPILATION_COMMENT_SERVER, other programs useCOMPILATION_COMMENT.-DCOMPRESS_DEBUG_SECTIONS=bool-DCOMPRESS_DEBUG_SECTIONS=bool是否压缩二进制可执行文件的调试部分(仅限 Linux)。压缩可执行调试部分可以节省空间,但代价是构建过程中需要额外的 CPU 时间。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.
默认值为
OFF。如果未显式设置此选项,但设置了COMPRESS_DEBUG_SECTIONS环境变量,则该选项将从该变量获取其值。The default isOFF. If this option is not set explicitly but theCOMPRESS_DEBUG_SECTIONSenvironment variable is set, the option takes its value from that variable.-DCOMPILATION_COMMENT_SERVER=string-DCOMPILATION_COMMENT_SERVER=string有关 mysqld 使用的编译环境的描述性注释(例如,设置
version_comment系统变量)。服务器以外的程序使用COMPILATION_COMMENT。A descriptive comment about the compilation environment for use by mysqld (for example, to set theversion_commentsystem variable). Programs other than the server useCOMPILATION_COMMENT.-DDEFAULT_CHARSET=charset_name-DDEFAULT_CHARSET=charset_name服务器字符集。默认情况下,MySQL 使用
utf8mb4字符集。The server character set. By default, MySQL uses theutf8mb4character set.charset_name可以是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、utf8mb3、utf8mb4、utf16、utf16le、utf32。charset_namemay be one ofbinary,armscii8,ascii,big5,cp1250,cp1251,cp1256,cp1257,cp850,cp852,cp866,cp932,dec8,eucjpms,euckr,gb2312,gbk,geostd8,greek,hebrew,hp8,keybcs2,koi8r,koi8u,latin1,latin2,latin5,latin7,macce,macroman,sjis,swe7,tis620,ucs2,ujis,utf8mb3,utf8mb4,utf16,utf16le,utf32.此值可以在服务器启动时使用
--character-set-server设置选项。This value can be set at server startup with the--character-set-serveroption.-DDEFAULT_COLLATION=collation_name-DDEFAULT_COLLATION=collation_name服务器排序规则。默认情况下,MySQL 使用
utf8mb4_0900_ai_ci。使用SHOW COLLATION语句确定每个字符集可用的排序规则。The server collation. By default, MySQL usesutf8mb4_0900_ai_ci. Use theSHOW COLLATIONstatement to determine which collations are available for each character set.可以在服务器启动时使用
--collation_server选项。This value can be set at server startup with the--collation_serveroption.-DDISABLE_PSI_COND=bool-DDISABLE_PSI_COND=bool是否排除性能架构条件检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema condition instrumentation. The default isOFF(include).-DDISABLE_PSI_FILE=bool-DDISABLE_PSI_FILE=bool是否排除性能架构文件检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema file instrumentation. The default isOFF(include).-DDISABLE_PSI_IDLE=bool-DDISABLE_PSI_IDLE=bool是否排除性能模式空闲检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema idle instrumentation. The default isOFF(include).-DDISABLE_PSI_MEMORY=bool-DDISABLE_PSI_MEMORY=bool是否排除性能架构内存检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema memory instrumentation. The default isOFF(include).-DDISABLE_PSI_METADATA=bool-DDISABLE_PSI_METADATA=bool是否排除性能模式元数据检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema metadata instrumentation. The default isOFF(include).-DDISABLE_PSI_MUTEX=bool-DDISABLE_PSI_MUTEX=bool是否排除性能架构互斥检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema mutex instrumentation. The default isOFF(include).-DDISABLE_PSI_RWLOCK=bool-DDISABLE_PSI_RWLOCK=bool是否排除性能架构 rwlock 检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema rwlock instrumentation. The default isOFF(include).-DDISABLE_PSI_SOCKET=bool-DDISABLE_PSI_SOCKET=bool是否排除性能架构套接字检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema socket instrumentation. The default isOFF(include).-DDISABLE_PSI_SP=bool-DDISABLE_PSI_SP=bool是否排除性能模式存储程序检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema stored program instrumentation. The default isOFF(include).-DDISABLE_PSI_STAGE=bool-DDISABLE_PSI_STAGE=bool是否排除 Performance Schema 阶段检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema stage instrumentation. The default isOFF(include).-DDISABLE_PSI_STATEMENT=bool-DDISABLE_PSI_STATEMENT=bool是否排除 Performance Schema 语句检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema statement instrumentation. The default isOFF(include).-DDISABLE_PSI_STATEMENT_DIGEST=bool-DDISABLE_PSI_STATEMENT_DIGEST=bool是否排除性能模式语句摘要检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema statement digest instrumentation. The default isOFF(include).-DDISABLE_PSI_TABLE=bool-DDISABLE_PSI_TABLE=bool是否排除性能架构表检测。默认值为
OFF(包含)。Whether to exclude the Performance Schema table instrumentation. The default isOFF(include).-DDISABLE_PSI_PS=bool-DDISABLE_PSI_PS=bool排除性能模式准备好的语句实例检测。默认值为
OFF(包含)。Exclude the Performance Schema prepared statements instances instrumentation. The default isOFF(include).-DDISABLE_PSI_THREAD=bool-DDISABLE_PSI_THREAD=bool排除性能架构线程检测。默认值为
OFF(包含)。Exclude the Performance Schema thread instrumentation. The default isOFF(include).仅在没有任何检测的情况下构建时禁用线程,因为其他检测依赖于线程。Only disable threads when building without any instrumentation, because other instrumentations have a dependency on threads.
-DDISABLE_PSI_TRANSACTION=bool-DDISABLE_PSI_TRANSACTION=bool排除性能架构事务检测。默认值为
OFF(包含)。Exclude the Performance Schema transaction instrumentation. The default isOFF(include).-DDISABLE_PSI_DATA_LOCK=bool-DDISABLE_PSI_DATA_LOCK=bool排除性能架构数据锁定检测。默认值为
OFF(包含)。Exclude the performance schema data lock instrumentation. The default isOFF(include).-DDISABLE_PSI_ERROR=bool-DDISABLE_PSI_ERROR=bool排除性能架构服务器错误检测。默认值为
OFF(包含)。Exclude the performance schema server error instrumentation. The default isOFF(include).-DENABLE_EXPERIMENTAL_SYSVARS=bool-DENABLE_EXPERIMENTAL_SYSVARS=bool是否启用实验性
InnoDB系统变量。实验系统变量适用于那些从事 MySQL 开发的人员,只能在开发或测试环境中使用,并且可能会在未来的 MySQL 版本中删除,恕不另行通知。有关实验性系统变量的信息,请参阅 MySQL 源代码树中的/storage/innobase/handler/ha_innodb.cc。实验系统变量可以通过搜索“PLUGIN_VAR_EXPERIMENTAL”来识别。Whether to enable experimentalInnoDBsystem 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.ccin the MySQL source tree. Experimental system variables can be identified by searching for “PLUGIN_VAR_EXPERIMENTAL”.-DENABLE_GCOV=bool-DENABLE_GCOV=bool是否包含gcov 支持(仅限 Linux)。Whether to include gcov support (Linux only).
-DENABLE_GPROF=bool-DENABLE_GPROF=bool是否启用gprof(仅限优化的 Linux 版本)。Whether to enable gprof (optimized Linux builds only).
-DENABLED_LOCAL_INFILE=bool-DENABLED_LOCAL_INFILE=bool此选项控制 MySQL 客户端库的编译默认
LOCAL功能。因此,未做出明确安排的客户端会根据 MySQL 构建时指定的ENABLED_LOCAL_INFILE设置禁用或启用LOCAL功能。This option controls the compiled-in defaultLOCALcapability for the MySQL client library. Clients that make no explicit arrangements therefore haveLOCALcapability disabled or enabled according to theENABLED_LOCAL_INFILEsetting specified at MySQL build time.默认情况下,MySQL 二进制发行版中的客户端库是使用
ENABLED_LOCAL_INFILE已禁用。如果您从源代码编译 MySQL,请根据未做出明确安排的客户端是否应禁用或启用LOCAL功能来分别禁用或启用ENABLED_LOCAL_INFILE进行配置。By default, the client library in MySQL binary distributions is compiled withENABLED_LOCAL_INFILEdisabled. If you compile MySQL from source, configure it withENABLED_LOCAL_INFILEdisabled or enabled based on whether clients that make no explicit arrangements should haveLOCALcapability disabled or enabled, respectively.ENABLED_LOCAL_INFILE控制客户端LOCAL功能的默认设置。对于服务器,local_infile系统变量控制服务器端LOCAL功能。要显式地使服务器拒绝或允许LOAD DATA LOCAL语句(无论客户端程序和库在构建时或运行时如何配置),请启动 mysqld 分别禁用或启用--local-infile。local_infile也可以在运行时设置。请参阅第 8.1.6 节“LOAD DATA LOCAL 的安全注意事项”。ENABLED_LOCAL_INFILEcontrols the default for client-sideLOCALcapability. For the server, thelocal_infilesystem variable controls server-sideLOCALcapability. To explicitly cause the server to refuse or permitLOAD DATA LOCALstatements (regardless of how client programs and libraries are configured at build time or runtime), start mysqld with--local-infiledisabled or enabled, respectively.local_infilecan also be set at runtime. See Section 8.1.6, “Security Considerations for LOAD DATA LOCAL”.-DENABLED_PROFILING=bool-DENABLED_PROFILING=bool是否启用查询分析代码(对于
SHOW PROFILE和SHOW PROFILES语句)。Whether to enable query profiling code (for theSHOW PROFILEandSHOW PROFILESstatements).-DFORCE_UNSUPPORTED_COMPILER=bool-DFORCE_UNSUPPORTED_COMPILER=bool默认情况下,CMake 检查支持的编译器的最低版本;要禁用此检查,请使用
-DFORCE_UNSUPPORTED_COMPILER=ON。By default, CMake checks for minimum versions of supported compilers; to disable this check, use-DFORCE_UNSUPPORTED_COMPILER=ON.-DFPROFILE_GENERATE=bool-DFPROFILE_GENERATE=boolWhether to generate profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. See
cmake/fprofile.cmakein the MySQL source distribution for information about usingFPROFILE_GENERATE以及FPROFILE_USE. These options have been tested with GCC 8 and 9.Whether to generate profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. Seecmake/fprofile.cmakein the MySQL source distribution for information about usingFPROFILE_GENERATEandFPROFILE_USE. These options have been tested with GCC 8 and 9.-DFPROFILE_USE=bool-DFPROFILE_USE=boolWhether to use profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. See the
cmake/fprofile.cmakefile in a MySQL source distribution for information about usingFPROFILE_GENERATE以及FPROFILE_USE. These options have been tested with GCC 8 and 9.Whether to use profile guided optimization (PGO) data. This option is available for experimenting with PGO with GCC. See thecmake/fprofile.cmakefile in a MySQL source distribution for information about usingFPROFILE_GENERATEandFPROFILE_USE. These options have been tested with GCC 8 and 9.启用
FPROFILE_USE还会启用WITH_LTO。EnablingFPROFILE_USEalso enablesWITH_LTO.-DHAVE_PSI_MEMORY_INTERFACE=bool-DHAVE_PSI_MEMORY_INTERFACE=bool是否为过度对齐类型的动态存储中使用的内存分配函数(
ut::aligned_库函数)启用性能架构内存跟踪模块。Whether to enable the performance schema memory tracing module for memory allocation functions (nameut::aligned_library functions) used in dynamic storage of over-aligned types.name-DIGNORE_AIO_CHECK=bool-DIGNORE_AIO_CHECK=bool如果
-DBUILD_CONFIG=mysql_release选项在 Linux 上给出,默认情况下必须链接libaio库。如果您没有libaio或不想安装它,可以通过指定-DIGNORE_AIO_CHECK=1来禁止对其进行检查。If the-DBUILD_CONFIG=mysql_releaseoption is given on Linux, thelibaiolibrary must be linked in by default. If you do not havelibaioor do not want to install it, you can suppress the check for it by specifying-DIGNORE_AIO_CHECK=1.-DMAX_INDEXES=num-DMAX_INDEXES=num每个表的最大索引数。默认值为 64。最大值为 255。小于 64 的值将被忽略,并使用默认值 64。The maximum number of indexes per table. The default is 64. The maximum is 255. Values smaller than 64 are ignored and the default of 64 is used.
-DMYSQL_MAINTAINER_MODE=bool-DMYSQL_MAINTAINER_MODE=bool是否启用 MySQL 维护者特定的开发环境。如果启用,此选项会导致编译器警告变为错误。Whether to enable a MySQL maintainer-specific development environment. If enabled, this option causes compiler warnings to become errors.
-DWITH_DEVELOPER_ENTITLEMENTS=bool-DWITH_DEVELOPER_ENTITLEMENTS=bool是否向所有可执行文件添加
get-task-allow权限,以便在服务器意外停止时生成核心转储。Whether to add theget-task-allowentitlement to all executables to generate a core dump in the event of an unexpected server halt.在 macOS 11+ 上,核心转储仅限于具有
com.apple.security.get-task-allow权限的进程,此 CMake 选项启用此功能。该权利允许其他进程附加和读取/修改进程内存,并允许--core-file按预期运行。On macOS 11+, core dumps are limited to processes with thecom.apple.security.get-task-allowentitlement, which this CMake option enables. The entitlement allows other processes to attach and read/modify the processes memory, and allows--core-fileto function as expected.-DMUTEX_TYPE=type-DMUTEX_TYPE=typeInnoDB使用的互斥类型。选项包括:The mutex type used byInnoDB. Options include:event:使用事件互斥体。这是默认值和原始InnoDB互斥体实现。event: Use event mutexes. This is the default value and the originalInnoDBmutex implementation.sys:在 UNIX 系统上使用 POSIX 互斥体。在 Windows 上使用CRITICAL_SECTION对象(如果可用)。sys: Use POSIX mutexes on UNIX systems. UseCRITICAL_SECTIONobjects on Windows, if available.futex:使用 Linux futex 而不是条件变量来调度等待线程。futex: Use Linux futexes instead of condition variables to schedule waiting threads.
-DMYSQLX_TCP_PORT=port_num-DMYSQLX_TCP_PORT=port_numX Plugin 侦听 TCP/IP 的端口号连接。默认值为 33060。The port number on which X Plugin listens for TCP/IP connections. The default is 33060.
可以在服务器启动时使用
mysqlx_port系统变量设置该值。This value can be set at server startup with themysqlx_portsystem variable.-DMYSQLX_UNIX_ADDR=file_name-DMYSQLX_UNIX_ADDR=file_name服务器侦听 X 插件套接字连接的 Unix 套接字文件路径。这必须是绝对路径名。默认为
/tmp/mysqlx.sock。The Unix socket file path on which the server listens for X Plugin socket connections. This must be an absolute path name. The default is/tmp/mysqlx.sock.可以在服务器启动时使用
mysqlx_port系统变量设置该值。This value can be set at server startup with themysqlx_portsystem variable.-DMYSQL_PROJECT_NAME=name-DMYSQL_PROJECT_NAME=name对于 Windows 或 macOS,要合并到项目文件名中的项目名称。For Windows or macOS, the project name to incorporate into the project file name.
-DMYSQL_TCP_PORT=port_num-DMYSQL_TCP_PORT=port_num服务器侦听 TCP/IP 连接的端口号。默认值为 3306。The port number on which the server listens for TCP/IP connections. The default is 3306.
可以在服务器启动时使用
--port选项设置该值。This value can be set at server startup with the--portoption.-DMYSQL_UNIX_ADDR=file_name-DMYSQL_UNIX_ADDR=file_name服务器侦听套接字连接的 Unix 套接字文件路径。这必须是绝对路径名。默认值为
/tmp/mysql.sock。The Unix socket file path on which the server listens for socket connections. This must be an absolute path name. The default is/tmp/mysql.sock.可以在服务器启动时使用
--socket选项设置该值。This value can be set at server startup with the--socketoption.-DOPTIMIZER_TRACE=bool-DOPTIMIZER_TRACE=bool是否支持优化器跟踪。请参阅第 10.15 节“跟踪优化器”。Whether to support optimizer tracing. See Section 10.15, “Tracing the Optimizer”.
-DREPRODUCIBLE_BUILD=bool-DREPRODUCIBLE_BUILD=bool对于 Linux 系统上的构建,此选项控制是否格外小心地创建独立于构建位置和时间的构建结果。For builds on Linux systems, this option controls whether to take extra care to create a build result independent of build location and time.
对于
RelWithDebInfo,此选项默认为ON构建。This option defaults toONforRelWithDebInfobuilds.-DSHOW_SUPPRESSED_COMPILER_WARNINGS=bool-DSHOW_SUPPRESSED_COMPILER_WARNINGS=bool显示抑制的编译器警告,并且这样做不会因
-Werror而失败。默认为OFF。Show suppressed compiler warnings, and do so without failing with-Werror. Defaults toOFF.-DWIN_DEBUG_NO_INLINE=bool-DWIN_DEBUG_NO_INLINE=bool是否在 Windows 上禁用函数内联。默认值为
OFF(启用内联)。Whether to disable function inlining on Windows. The default isOFF(inlining enabled).-DWITH_LD=string-DWITH_LD=stringCMake 默认使用标准链接器。可以选择传入
lld或mold来指定备用链接器。 mold 必须是版本 2 或更高版本。CMake uses the standard linker by default. Optionally pass inlldormoldto specify an alternative linker. mold must be version 2 or newer.此选项可用于除 Enterprise Linux 之外的基于 Linux 的系统,Enterprise Linux 始终使用 ld 链接器。This option can be used on Linux-based systems other than Enterprise Linux, which always uses the ld linker.
Note以前,选项
USE_LD_LLD可用于显式启用(默认)或禁用 Clang 的 LLVM lld 链接器。在 MySQL 8.3 中,USE_LD_LLD已被删除。Previously, the optionUSE_LD_LLDcould be used to enable (the default) or disable explicitly the LLVM lld linker for Clang. In MySQL 8.3,USE_LD_LLDhas been removed.-DWITH_ANT=path_name-DWITH_ANT=path_name设置 Ant 的路径,构建 GCS Java 包装器时需要。将
WITH_ANT设置为保存 Ant tarball 或解压存档的目录路径。当未设置WITH_ANT时,或者使用特殊值system设置时,构建过程会假定$PATH中存在二进制ant。Set the path to Ant, required when building GCS Java wrapper. SetWITH_ANTto the path of a directory where the Ant tarball or unpacked archive is saved. WhenWITH_ANTis not set, or is set with the special valuesystem, the build process assumes a binaryantexists in$PATH.-DWITH_ASAN=bool-DWITH_ASAN=bool是否启用 AddressSanitizer,对于支持它的编译器。默认值为
OFF。Whether to enable the AddressSanitizer, for compilers that support it. The default isOFF.-DWITH_ASAN_SCOPE=bool-DWITH_ASAN_SCOPE=bool是否启用 AddressSanitizer
-fsanitize-address-use-after-scopeClang 标志以进行范围后使用检测。默认关闭。要使用此选项,还必须启用-DWITH_ASAN。Whether to enable the AddressSanitizer-fsanitize-address-use-after-scopeClang flag for use-after-scope detection. The default is off. To use this option,-DWITH_ASANmust also be enabled.-DWITH_AUTHENTICATION_CLIENT_PLUGINS=bool-DWITH_AUTHENTICATION_CLIENT_PLUGINS=bool如果构建了任何相应的服务器身份验证插件,则会自动启用此选项。因此,其值取决于其他 CMake 选项,不应显式设置。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.
-DWITH_AUTHENTICATION_LDAP=bool-DWITH_AUTHENTICATION_LDAP=bool如果无法构建 LDAP 身份验证插件是否报告错误:Whether to report an error if the LDAP authentication plugins cannot be built:
如果禁用此选项(默认),则在找到所需的头文件和库时构建 LDAP 插件。如果不是,CMake 将显示相关注释。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.
如果启用此选项,则找不到所需的头文件和库会导致 CMake 产生错误,从而阻止构建服务器。If this option is enabled, a failure to find the required header file and libraries causes CMake to produce an error, preventing the server from being built.
-DWITH_AUTHENTICATION_PAM=bool-DWITH_AUTHENTICATION_PAM=bool是否为包含此插件的源代码树构建 PAM 身份验证插件。 (请参阅第 8.4.1.5 节“PAM 可插入身份验证”。)如果指定此选项并且无法编译插件,则构建会失败。Whether to build the PAM authentication plugin, for source trees that include this plugin. (See Section 8.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-DWITH_AWS_SDK=path_nameAmazon Web Services 软件开发工具包的位置。The location of the Amazon Web Services software development kit.
-DWITH_CLIENT_PROTOCOL_TRACING=bool-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.
另请参阅
WITH_TEST_TRACE_PLUGIN选项。See also theWITH_TEST_TRACE_PLUGINoption.-DWITH_CURL=curl_type-DWITH_CURL=curl_typecurl库的位置。curl_type可以是system(使用系统curl库)、curl库的路径名、no|off|none禁用 curl 支持,或者bundled在extra/curl/中使用捆绑的 curl 发行版。The location of thecurllibrary.curl_typecan besystem(use the systemcurllibrary), a path name to thecurllibrary,no|off|noneto disable curl support, orbundledto use the bundled curl distribution inextra/curl/.-DWITH_DEBUG=bool-DWITH_DEBUG=bool是否包含调试支持。Whether to include debugging support.
通过调试支持配置 MySQL,您可以在启动服务器时使用
--debug="d,parser_debug"选项。这会导致用于处理 SQL 语句的 Bison 解析器将解析器跟踪转储到服务器的标准错误输出。通常,此输出会写入错误日志。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.InnoDB存储引擎的同步调试检查在UNIV_DEBUG下定义,并且在使用WITH_DEBUG选项编译调试支持时可用。编译调试支持后,innodb_sync_debug配置选项可用于启用或禁用InnoDB同步调试检查。Sync debug checking for theInnoDBstorage engine is defined underUNIV_DEBUGand is available when debugging support is compiled in using theWITH_DEBUGoption. When debugging support is compiled in, theinnodb_sync_debugconfiguration option can be used to enable or disableInnoDBsync debug checking.启用
WITH_DEBUG也会启用调试同步(Debug Sync)。该功能用于测试和调试。当编译时包含此功能,运行时默认禁用调试同步。要启用它,可通过启动mysqld并使用--debug-sync-timeout=选项来实现,其中NN是大于 0 的超时值。(默认值为 0,表示禁用调试同步。)N成为单个同步点的默认超时值。EnablingWITH_DEBUGalso 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, whereNNis a timeout value greater than 0. (The default value is 0, which disables Debug Sync.)Nbecomes the default timeout for individual synchronization points.该选项
InnoDB译调试支持时,存储引擎的WITH_DEBUG同步调试检查Sync debug checking for theInnoDBstorage engine is available when debugging support is compiled in using theWITH_DEBUGoption.有关调试同步工具以及如何使用同步点的说明,请参阅 MySQL 内部结构:测试同步。For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.
-DWITH_EDITLINE=value-DWITH_EDITLINE=value哪个
libedit/editline库。允许的值为bundled(默认)和system.Whichlibedit/editlinelibrary to use. The permitted values arebundled(the default) andsystem.-DWITH_ICU={icu_type|path_name}-DWITH_ICU={icu_type|path_name}MySQL 使用 Unicode 国际组件 (ICU) 来支持正则表达式操作。
WITH_ICU选项指示要包含的 ICU 支持类型或要使用的 ICU 安装路径名称。MySQL uses International Components for Unicode (ICU) to support regular expression operations. TheWITH_ICUoption indicates the type of ICU support to include or the path name to the ICU installation to use.icu_type可以是以下值之一:icu_typecan be one of the following values:bundled:使用与发行版捆绑在一起的 ICU 库。这是默认设置,也是 Windows 唯一支持的选项。bundled: Use the ICU library bundled with the distribution. This is the default, and is the only supported option for Windows.system:使用系统 ICU 库。system: Use the system ICU library.
path_name是要使用的 ICU 安装的路径名称。这比使用system的icu_type值更好,因为它可以防止 CMake 检测和使用系统上安装的较旧或不正确的 ICU 版本。 (执行相同操作的另一种允许方法是将WITH_ICU设置为system并将CMAKE_PREFIX_PATH选项设置为path_name。)path_nameis the path name to the ICU installation to use. This can be preferable to using theicu_typevalue ofsystembecause it can prevent CMake from detecting and using an older or incorrect ICU version installed on the system. (Another permitted way to do the same thing is to setWITH_ICUtosystemand set theCMAKE_PREFIX_PATHoption topath_name.)
-DWITH_INNODB_EXTRA_DEBUG=bool-DWITH_INNODB_EXTRA_DEBUG=bool是否包含额外的 InnoDB 调试支持。Whether to include extra InnoDB debugging support.
启用
WITH_INNODB_EXTRA_DEBUG打开额外的 InnoDB 调试检查。仅当启用WITH_DEBUG时才能启用此选项。EnablingWITH_INNODB_EXTRA_DEBUGturns on extra InnoDB debug checks. This option can only be enabled whenWITH_DEBUGis enabled.-DWITH_JEMALLOC=bool-DWITH_JEMALLOC=bool是否与
-ljemalloc链接。如果启用,内置malloc()、calloc()、realloc()和free()例程将被禁用。默认值为OFF。Whether to link with-ljemalloc. If enabled, built-inmalloc(),calloc(),realloc(), andfree()routines are disabled. The default isOFF.WITH_JEMALLOC和WITH_TCMALLOC是互斥的。WITH_JEMALLOCandWITH_TCMALLOCare mutually exclusive.-DWITH_LIBEVENT=string-DWITH_LIBEVENT=string要使用哪个
libevent库。允许的值为bundled(默认)和system。如果指定了system并且找不到系统libevent库,则无论如何都会发生错误,并且不会使用捆绑的libevent。Whichlibeventlibrary to use. Permitted values arebundled(default) andsystem. Ifsystemis specified and no systemlibeventlibrary can be found, an error occurs regardless, and the bundledlibeventis not used.X Plugin 和 MySQL Router 需要
libevent库。Thelibeventlibrary is required by X Plugin and MySQL Router.-DWITH_LIBWRAP=bool-DWITH_LIBWRAP=bool是否包含
libwrap(TCP 包装器)支持。Whether to includelibwrap(TCP wrappers) support.-DWITH_LOCK_ORDER=bool-DWITH_LOCK_ORDER=bool是否启用 LOCK_ORDER 工具。默认情况下,此选项处于禁用状态,并且服务器版本不包含任何工具。如果启用了工具,则 LOCK_ORDER 工具可用,并且可以按照第 7.9.3 节“LOCK_ORDER 工具”中的说明使用。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 7.9.3, “The LOCK_ORDER Tool”.
Note启用
WITH_LOCK_ORDER选项后,MySQL 构建需要该flex程序。With theWITH_LOCK_ORDERoption enabled, MySQL builds require the flex program.-DWITH_LSAN=bool-DWITH_LSAN=bool是否运行 LeakSanitizer,不运行 AddressSanitizer。默认为
OFF。Whether to run LeakSanitizer, without AddressSanitizer. The default isOFF.-DWITH_LTO=bool-DWITH_LTO=bool是否启用链接时优化器(如果编译器支持)。默认值为
OFF,除非启用FPROFILE_USE。Whether to enable the link-time optimizer, if the compiler supports it. The default isOFFunlessFPROFILE_USEis enabled.-DWITH_LZ4=lz4_type-DWITH_LZ4=lz4_typeWITH_LZ4选项指示zlib支持的来源:TheWITH_LZ4option indicates the source ofzlibsupport:bundled:使用与发行版捆绑的lz4库。这是默认设置。bundled: Use thelz4library bundled with the distribution. This is the default.system:使用系统lz4库。system: Use the systemlz4library.
-DWITH_MECAB={disabled|system|path_name}-DWITH_MECAB={disabled|system|path_name}使用此选项编译 MeCab 解析器。如果您已将 MeCab 安装到默认安装目录,请设置
-DWITH_MECAB=system。system选项适用于使用本机包管理实用程序从源代码或二进制文件执行的 MeCab 安装。如果您将 MeCab 安装到自定义安装目录,请指定 MeCab 安装路径,例如-DWITH_MECAB=/opt/mecab。如果system选项不起作用,则指定 MeCab 安装路径应该在所有情况下都起作用。Use this option to compile the MeCab parser. If you have installed MeCab to its default installation directory, set-DWITH_MECAB=system. Thesystemoption 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 thesystemoption does not work, specifying the MeCab installation path should work in all cases.有关信息,请参阅第 14.9.9 节“MeCab 全文解析器”插件”。For related information, see Section 14.9.9, “MeCab Full-Text Parser Plugin”.
-DWITH_MSAN=bool-DWITH_MSAN=bool是否启用 MemorySanitizer,对于支持的编译器它。默认关闭。Whether to enable MemorySanitizer, for compilers that support it. The default is off.
要使此选项在启用后生效,链接到 MySQL 的所有库也必须在启用该选项的情况下进行编译。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-DWITH_MSCRT_DEBUG=bool是否启用 Visual Studio CRT 内存泄漏跟踪。默认值为
OFF。Whether to enable Visual Studio CRT memory leak tracing. The default isOFF.-DMSVC_CPPCHECK=bool-DMSVC_CPPCHECK=bool是否启用 MSVC 代码分析。默认为
ON。Whether to enable MSVC code analysis. The default isON.-DWITH_MYSQLX=bool-DWITH_MYSQLX=bool是否构建支持 X 插件。默认值为
ON。请参阅第 22 章,使用 MySQL 作为文档存储。Whether to build with support for X Plugin. The default isON. See Chapter 22, Using MySQL as a Document Store.-DWITH_NUMA=bool-DWITH_NUMA=bool显式设置 NUMA 内存分配策略。 CMake 根据当前平台是否支持
NUMA设置默认的WITH_NUMA值。对于不支持 NUMA 的平台,CMake 的行为如下:Explicitly set the NUMA memory allocation policy. CMake sets the defaultWITH_NUMAvalue based on whether the current platform hasNUMAsupport. For platforms without NUMA support, CMake behaves as follows:如果没有 NUMA 选项(正常情况),CMake 会正常继续,仅生成此警告:NUMA 库丢失或所需版本不可用。With no NUMA option (the normal case), CMake continues normally, producing only this warning: NUMA library missing or required version not available.
使用
-DWITH_NUMA=ON,CMake 中止并出现以下错误:NUMA 库丢失或所需版本不可用。With-DWITH_NUMA=ON, CMake aborts with this error: NUMA library missing or required version not available.
-DWITH_PACKAGE_FLAGS=bool-DWITH_PACKAGE_FLAGS=bool对于通常用于 RPM 和 Debian 软件包的标志,是否将它们添加到这些平台上的独立构建中。对于非调试版本,默认值为
ON。For flags typically used for RPM and Debian packages, whether to add them to standalone builds on those platforms. The default isONfor nondebug builds.-DWITH_PROTOBUF=protobuf_type-DWITH_PROTOBUF=protobuf_type要使用的 Protocol Buffers 包。
protobuf_type可以是以下值之一:Which Protocol Buffers package to use.protobuf_typecan be one of the following values:bundled:使用与发行版捆绑在一起的包。这是默认设置。 (可选)使用INSTALL_PRIV_LIBDIR修改动态 Protobuf 库目录。bundled: Use the package bundled with the distribution. This is the default. Optionally useINSTALL_PRIV_LIBDIRto modify the dynamic Protobuf library directory.system:使用系统上安装的软件包。system: Use the package installed on the system.
其他值将被忽略,并回退到
bundled.Other values are ignored, with a fallback tobundled.-DWITH_RAPID=bool-DWITH_RAPID=bool是否构建快速开发周期插件。启用后,将在包含这些插件的构建树中创建一个
rapid目录。禁用后,不会在构建树中创建rapid目录。默认值为ON,除非rapid目录已从源代码树中删除,在这种情况下,默认值为OFF。Whether to build the rapid development cycle plugins. When enabled, arapiddirectory is created in the build tree containing these plugins. When disabled, norapiddirectory is created in the build tree. The default isON, unless therapiddirectory is removed from the source tree, in which case the default becomesOFF.-DWITH_RAPIDJSON=rapidjson_type-DWITH_RAPIDJSON=rapidjson_type要包含的 RapidJSON 库支持的类型。
rapidjson_type可以是以下值之一:The type of RapidJSON library support to include.rapidjson_typecan be one of the following values:bundled:使用与发行版捆绑的 RapidJSON 库。这是默认值。bundled: Use the RapidJSON library bundled with the distribution. This is the default.system:使用系统 RapidJSON 库。需要 1.1.0 或更高版本。system: Use the system RapidJSON library. Version 1.1.0 or later is required.
-DWITH_ROUTER=bool-DWITH_ROUTER=bool是否构建 MySQL Router。默认为
ON。Whether to build MySQL Router. The default isON.-DWITH_SASL=value-DWITH_SASL=value内部使用仅。 Windows 上不支持。Internal use only. Not supported on Windows.
-DWITH_SSL={|ssl_typepath_name}-DWITH_SSL={|ssl_typepath_name}为了支持加密连接、随机数生成的熵以及其他与加密相关的操作,MySQL 必须使用 SSL 库构建。此选项指定要使用哪个 SSL 库。For support of encrypted connections, entropy for random number generation, and other encryption-related operations, MySQL must be built using an SSL library. This option specifies which SSL library to use.
ssl_type可以是以下值之一:ssl_typecan be one of the following values:system:使用系统 OpenSSL 库。这是默认设置。system: Use the system OpenSSL library. This is the default.在 macOS 和 Windows 上,使用
system将 MySQL 配置为构建,就像使用指向手动安装的 OpenSSL 库的path_name调用 CMake 一样。这是因为他们没有系统 SSL 库。在 macOS 上,brew install openssl 安装到/usr/local/opt/openssl,以便system可以找到它。在 Windows 上,它检查%ProgramFiles%/OpenSSL、%ProgramFiles%/OpenSSL-Win32、%ProgramFiles%/OpenSSL-Win64、C:/OpenSSL、C:/OpenSSL-Win32和C:/OpenSSL-Win64.On macOS and Windows, usingsystemconfigures MySQL to build as if CMake was invoked withpath_namepoints 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/opensslso thatsystemcan find it. On Windows, it checks%ProgramFiles%/OpenSSL,%ProgramFiles%/OpenSSL-Win32,%ProgramFiles%/OpenSSL-Win64,C:/OpenSSL,C:/OpenSSL-Win32, andC:/OpenSSL-Win64.yes:这是system的同义词。yes: This is a synonym forsystem.openssl:使用备用 OpenSSL 系统包,例如versionopenssl11,或 EL8 上的openssl3(或openssl3-fips)。openssl: Use an alternate OpenSSL system package such asversionopenssl11on EL7, oropenssl3(oropenssl3-fips) on EL8.身份验证插件(例如 LDAP 和 Kerberos)已被禁用,因为它们不支持这些替代版本的 OpenSSL。Authentication plugins, such as LDAP and Kerberos, are disabled as they do not support these alternative versions of OpenSSL.
path_name是要使用的 OpenSSL 安装的路径名。这比使用ssl_type值system更好,因为它可以防止 CMake 检测和使用系统上安装的较旧或不正确的 OpenSSL 版本。 (执行相同操作的另一种允许方法是将WITH_SSL设置为system并将CMAKE_PREFIX_PATH选项设置为path_name。)path_nameis the path name to the OpenSSL installation to use. This can be preferable to using thessl_typevaluesystembecause it can prevent CMake from detecting and using an older or incorrect OpenSSL version installed on the system. (Another permitted way to do the same thing is to setWITH_SSLtosystemand set theCMAKE_PREFIX_PATHoption topath_name.)
有关配置 SSL 库的更多信息,请参阅 第 2.8.6 节,“配置 SSL 库支持”。For additional information about configuring the SSL library, see Section 2.8.6, “Configuring SSL Library Support”.
-DWITH_SHOW_PARSE_TREE=bool-DWITH_SHOW_PARSE_TREE=bool在服务器中启用对
SHOW PARSE_TREE的支持,仅用于开发和调试。不用于发布版本或在生产中受支持。Enables support forSHOW PARSE_TREEin the server, used in development and debugging only. Not used for release builds or supported in production.-DWITH_SYSTEMD=bool-DWITH_SYSTEMD=bool是否启用安装systemd 支持文件。默认情况下,此选项处于禁用状态。启用后,将安装 systemd 支持文件,但不会安装 mysqld_safe 等脚本和 System V 初始化脚本。在 systemd 不可用的平台上,启用
WITH_SYSTEMD会导致 CMake 出现错误。Whether to enable installation of systemd support files. By default, this option is disabled. When enabled, systemd support files are installed, and scripts such as mysqld_safe and the System V initialization script are not installed. On platforms where systemd is not available, enablingWITH_SYSTEMDresults in an error from CMake.使用此选项构建服务器时, MySQL 在服务器的错误日志中包含所有 systemd 消息(请参阅第 7.4.2 节“错误日志”)。When the server was built using this option, MySQL includes all systemd messages in the server's error log (see Section 7.4.2, “The Error Log”).
有关使用 systemd 的更多信息,请参阅第 2.5.9 节,“使用 systemd 管理 MySQL 服务器”。该部分还包括有关指定选项的信息,否则在
[mysqld_safe]选项组中指定。由于使用 systemd 时未安装 mysqld_safe,因此必须以其他方式指定此类选项。For more information about using systemd, see Section 2.5.9, “Managing MySQL Server with systemd”. That section also includes information about specifying options otherwise 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-DWITH_SYSTEM_LIBS=bool此选项用作 “umbrella” 选项,用于设置以下任何未明确设置的 CMake 选项的
system值:WITH_CURL、WITH_EDITLINE、WITH_ICU、WITH_LIBEVENT、WITH_LZ4、WITH_LZMA,WITH_PROTOBUF,WITH_RE2,WITH_SSL、WITH_ZLIB、WITH_ZSTD。This option serves as an “umbrella” option to set thesystemvalue 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-DWITH_SYSTEMD_DEBUG=bool是否为使用systemd运行 MySQL 的平台生成额外的systemd调试信息。默认值为
OFF。Whether to produce additional systemd debugging information, for platforms on which systemd is used to run MySQL. The default isOFF.-DWITH_TCMALLOC=bool-DWITH_TCMALLOC=bool是否与
-ltcmalloc链接。如果启用,内置malloc()、calloc()、realloc()和free()例程将被禁用。默认值为OFF。Whether to link with-ltcmalloc. If enabled, built-inmalloc(),calloc(),realloc(), andfree()routines are disabled. The default isOFF.从 MySQL 8.4.1 开始,源代码中包含
tcmalloc库;您可以通过将此选项设置为BUNDLED来使构建使用捆绑版本。BUNDLED仅在 Linux 系统上受支持。Beginning with MySQL 8.4.1, atcmalloclibrary is included in the source; you can cause the build to use the bundled version by setting this option toBUNDLED.BUNDLEDis supported on Linux systems only.WITH_TCMALLOC和WITH_JEMALLOC是互斥的。WITH_TCMALLOCandWITH_JEMALLOCare mutually exclusive.-DWITH_TEST_TRACE_PLUGIN=bool-DWITH_TEST_TRACE_PLUGIN=bool是否构建测试协议跟踪客户端插件(请参阅使用测试协议跟踪插件)。默认情况下,此选项处于禁用状态。除非启用
WITH_CLIENT_PROTOCOL_TRACING选项,否则启用此选项无效。如果 MySQL 配置为启用这两个选项,则使用内置的测试协议跟踪插件构建libmysqlclient客户端库,并且所有标准 MySQL 客户端都会加载该插件。然而,即使启用了测试插件,默认情况下也没有效果。使用环境变量可以控制插件;请参阅使用测试协议跟踪插件。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 theWITH_CLIENT_PROTOCOL_TRACINGoption is enabled. If MySQL is configured with both options enabled, thelibmysqlclientclient 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不要启用
WITH_TEST_TRACE_PLUGIN选项(如果您想使用自己的协议跟踪插件)选项,因为一次只能加载一个此类插件,并且尝试加载第二个插件时会发生错误。如果您已经构建了启用了测试协议跟踪插件以了解其工作原理的 MySQL,则必须在不使用它的情况下重新构建 MySQL,然后才能使用自己的插件。Do not enable theWITH_TEST_TRACE_PLUGINoption if you want to use your own protocol trace plugins because only one such plugin can be loaded at a time and an error occurs for attempts to load a second one. If you have already built MySQL with the test protocol trace plugin enabled to see how it works, you must rebuild MySQL without it before you can use your own plugins.有关编写跟踪插件的信息,请参阅编写协议跟踪插件。For information about writing trace plugins, see Writing Protocol Trace Plugins.
-DWITH_TSAN=bool-DWITH_TSAN=bool是否启用 ThreadSanitizer,对于支持它的编译器。默认关闭。Whether to enable the ThreadSanitizer, for compilers that support it. The default is off.
-DWITH_UBSAN=bool-DWITH_UBSAN=bool是否为编译器启用未定义行为清理程序支持它。默认关闭。Whether to enable the Undefined Behavior Sanitizer, for compilers that support it. The default is off.
-DWITH_UNIT_TESTS={ON|OFF}-DWITH_UNIT_TESTS={ON|OFF}如果启用,则使用单元测试编译 MySQL。默认值为
ON,除非未编译服务器。If enabled, compile MySQL with unit tests. The default isONunless the server is not being compiled.-DWITH_UNIXODBC=1-DWITH_UNIXODBC=1为 Connector/ODBC 启用 unixODBC 支持。Enables unixODBC support, for Connector/ODBC.
-DWITH_VALGRIND=bool-DWITH_VALGRIND=bool是否在 Valgrind 头文件中编译,这会公开 Valgrind API 到 MySQL 代码。默认值为
OFF。Whether to compile in the Valgrind header files, which exposes the Valgrind API to MySQL code. The default isOFF.要生成 Valgrind 感知的调试版本,
-DWITH_VALGRIND=1通常与-DWITH_DEBUG=1。请参阅构建调试配置。To generate a Valgrind-aware debug build,-DWITH_VALGRIND=1normally is combined with-DWITH_DEBUG=1. See Building Debug Configurations.-DWITH_WIN_JEMALLOC=string-DWITH_WIN_JEMALLOC=string在 Windows 上,传入包含
jemalloc.dll的目录路径以启用 jemalloc 功能。构建系统将jemalloc.dll复制到与mysqld.exe和/或mysqld-debug.exe相同的目录,并利用它进行内存管理操作。如果未找到jemalloc.dll或未导出所需函数,则使用标准内存函数。信息级别日志消息记录是否找到并使用 jemalloc。On Windows, pass in a path to a directory containingjemalloc.dllto enable jemalloc functionality. The build system copiesjemalloc.dllto the same directory asmysqld.exeand/ormysqld-debug.exeand utilizes it for memory management operations. Standard memory functions are used ifjemalloc.dllis not found or does not export the required functions. An INFORMATION level log message records whether or not jemalloc is found and used.此选项针对 Windows 的官方 MySQL 二进制文件启用。This option is enabled for official MySQL binaries for Windows.
-DWITH_ZLIB=zlib_type-DWITH_ZLIB=zlib_type某些功能要求服务器构建时支持压缩库,例如
COMPRESS()和UNCOMPRESS()函数,以及客户端/服务器协议的压缩。WITH_ZLIB选项指示zlib支持的来源:Some features require that the server be built with compression library support, such as theCOMPRESS()andUNCOMPRESS()functions, and compression of the client/server protocol. TheWITH_ZLIBoption indicates the source ofzlibsupport:zlib支持的最低版本为 1.2.13。The minimum supported version ofzlibis 1.2.13.bundled:使用与发行版捆绑的zlib库。这是默认设置。bundled: Use thezliblibrary bundled with the distribution. This is the default.system:使用系统zlib库。system: Use the systemzliblibrary.
-DWITH_ZSTD=zstd_type-DWITH_ZSTD=zstd_type使用
zstd算法进行连接压缩(请参阅第 6.2.8 节“连接压缩控制”)要求使用zstd库支持构建服务器。WITH_ZSTD选项指示zstd支持的来源:Connection compression using thezstdalgorithm (see Section 6.2.8, “Connection Compression Control”) requires that the server be built withzstdlibrary support. TheWITH_ZSTDoption indicates the source ofzstdsupport:bundled:使用与发行版捆绑的zstd库。这是默认值。bundled: Use thezstdlibrary bundled with the distribution. This is the default.system:使用系统zstd库。system: Use the systemzstdlibrary.
-DWITHOUT_SERVER=bool-DWITHOUT_SERVER=bool是否在没有 MySQL Server 的情况下构建。默认值为“关闭”,这会构建服务器。Whether to build without MySQL Server. The default is OFF, which does build the server.
这被认为是一个实验性选项;最好与服务器一起构建。This is considered an experimental option; it is preferred to build with the server.
此选项还可以阻止构建
NDB存储引擎或任何NDB二进制文件,包括管理和数据节点程序。This option also prevents building of theNDBstorage engine or anyNDBbinaries including management and data node programs.
-DCMAKE_C_FLAGS="flags"-DCMAKE_C_FLAGS=""flagsC 编译器的标志。Flags for the C compiler.
-DCMAKE_CXX_FLAGS="flags"-DCMAKE_CXX_FLAGS=""flagsC++ 编译器的标志。Flags for the C++ compiler.
-DWITH_DEFAULT_COMPILER_OPTIONS=bool-DWITH_DEFAULT_COMPILER_OPTIONS=bool是否使用
cmake/build_configurations/compiler_options.cmake中的标志。Whether to use the flags fromcmake/build_configurations/compiler_options.cmake.Note所有优化标志均由 MySQL 构建团队仔细选择和测试。覆盖它们可能会导致意外结果,您需要自行承担风险。All optimization flags are carefully chosen and tested by the MySQL build team. Overriding them can lead to unexpected results and is done at your own risk.
-DOPTIMIZE_SANITIZER_BUILDS=bool-DOPTIMIZE_SANITIZER_BUILDS=bool是否将
-O1 -fno-inline添加到 sanitizer 版本。默认值为ON。Whether to add-O1 -fno-inlineto sanitizer builds. The default isON.
要指定您自己的 C 和 C++ 编译器标志,对于不影响优化的标志,请使用 CMAKE_C_FLAGS 和 CMAKE_CXX_FLAGS CMake 选项。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.
在提供您自己的编译器标志时,您可能还需要指定 CMAKE_BUILD_TYPE。When providing your own compiler flags, you might want to
specify CMAKE_BUILD_TYPE as well.
例如,要在 64 位 Linux 计算机上创建 32 位版本构建,请执行以下操作:For example, to create a 32-bit release build on a 64-bit Linux machine, do this:
$>mkdir build$>cd build$>cmake .. -DCMAKE_C_FLAGS=-m32 \-DCMAKE_CXX_FLAGS=-m32 \-DCMAKE_BUILD_TYPE=RelWithDebInfo
如果您设置影响优化的标志(-O),您必须设置 numberCMAKE_C_FLAGS_ 和/或 build_typeCMAKE_CXX_FLAGS_ 选项,其中 build_typebuild_type 对应于 CMAKE_BUILD_TYPE 值。要为默认构建类型 (RelWithDebInfo) 指定不同的优化,请设置 CMAKE_C_FLAGS_RELWITHDEBINFO 和 CMAKE_CXX_FLAGS_RELWITHDEBINFO 选项。例如,要使用 -O3 和调试符号在 Linux 上进行编译,请执行以下操作:If you set flags that affect optimization
(-O), you must
set the
numberCMAKE_C_FLAGS_
and/or
build_typeCMAKE_CXX_FLAGS_
options, where build_typebuild_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"
要在支持 NDB Cluster 的情况下进行编译,可以使用 -DWITH_NDB,这会导致构建包含 NDB 存储引擎和所有 NDB 程序。默认情况下启用此选项。要阻止构建 NDB 存储引擎插件,请使用 -DWITH_NDBCLUSTER_STORAGE_ENGINE=OFF。可以使用本节中列出的其他选项来控制构建的其他方面。To compile with support for NDB Cluster, you can use
-DWITH_NDB, which causes the build
to include the NDB storage engine and all NDB programs. This
option is enabled by default. To prevent building of the NDB
storage engine plugin, use
-DWITH_NDBCLUSTER_STORAGE_ENGINE=OFF.
Other aspects of the build can be controlled using the other
options listed in this section.
构建具有 NDB Cluster 支持的 MySQL 源时适用以下选项。The following options apply when building the MySQL sources with NDB Cluster support.
-DNDB_UTILS_LINK_DYNAMIC={ON|OFF}-DNDB_UTILS_LINK_DYNAMIC={ON|OFF}控制 NDB 实用程序,例如 ndb_drop_table与
ndbclient静态(OFF)或动态(ON)链接;OFF(静态链接)是默认值。通常在构建它们时使用静态链接以避免LD_LIBRARY_PATH出现问题,或者在安装多个版本的ndbclient时使用静态链接。此选项用于创建 Docker 映像以及可能的其他情况,在这些情况下,目标环境需要精确控制,并且需要减小映像大小。Controls whether NDB utilities such as ndb_drop_table are linked withndbclientstatically (OFF) or dynamically (ON);OFF(static linking) is the default. Normally static linking is used when building these to avoid problems withLD_LIBRARY_PATH, or when multiple versions ofndbclientare installed. This option is intended for creating Docker images and possibly other cases in which the target environment is subject to precise control and it is desirable to reduce image size.-DWITH_CLASSPATH=path-DWITH_CLASSPATH=path设置用于构建 Java 的 MySQL NDB Cluster Connector 的类路径。默认为空。如果使用
-DWITH_NDB_JAVA=OFF,则忽略此选项。Sets the classpath for building MySQL NDB Cluster Connector for Java. The default is empty. This option is ignored if-DWITH_NDB_JAVA=OFFis used.-DWITH_ERROR_INSERT={ON|OFF}-DWITH_ERROR_INSERT={ON|OFF}在
NDB内核中启用错误注入。仅用于测试;不适用于构建生产二进制文件。默认为OFF。Enables error injection in theNDBkernel. For testing only; not intended for use in building production binaries. The default isOFF.-DWITH_NDB={ON|OFF}-DWITH_NDB={ON|OFF}构建 MySQL NDB 集群;构建 NDB 插件和所有 NDB Cluster 程序。Build MySQL NDB Cluster; build the NDB plugin and all NDB Cluster programs.
-DWITH_NDBAPI_EXAMPLES={ON|OFF}-DWITH_NDBAPI_EXAMPLES={ON|OFF}在
storage/ndb/ndbapi-examples/。有关这些的信息,请参阅 NDB API 示例。Build NDB API example programs instorage/ndb/ndbapi-examples/. See NDB API Examples, for information about these.-DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}-DWITH_NDBCLUSTER_STORAGE_ENGINE={ON|OFF}(仅)控制构建中是否包含
NDBCLUSTER存储引擎;WITH_NDB自动启用此选项,因此建议您使用WITH_NDB。Controls (only) whether theNDBCLUSTERstorage engine is included in the build;WITH_NDBenables this option automatically, so it is recommended that you useWITH_NDBinstead.-DWITH_NDBCLUSTER={ON|OFF}(已弃用)-DWITH_NDBCLUSTER={ON|OFF}(DEPRECATED)构建和链接以支持
NDBmysqld 中的存储引擎。Build and link in support for theNDBstorage engine in mysqld.此选项已弃用,最终将被删除;请改用
WITH_NDB。This option is deprecated and subject to eventual removal; useWITH_NDBinstead.-DWITH_NDBMTD={ON|OFF}-DWITH_NDBMTD={ON|OFF}构建多线程数据节点可执行文件ndbmtd。默认值为
ON。Build the multithreaded data node executable ndbmtd. The default isON.-DWITH_NDB_DEBUG={ON|OFF}-DWITH_NDB_DEBUG={ON|OFF}启用构建 NDB Cluster 二进制文件的调试版本。默认情况下,这是
OFF。Enable building the debug versions of the NDB Cluster binaries. This isOFFby default.-DWITH_NDB_JAVA={ON|OFF}-DWITH_NDB_JAVA={ON|OFF}启用使用 Java 支持构建 NDB Cluster,包括对 ClusterJ 的支持(请参阅适用于 Java 的 MySQL NDB Cluster Connector)。Enable building NDB Cluster with Java support, including support for ClusterJ (see MySQL NDB Cluster Connector for Java).
此选项默认为
ON。如果您不希望编译带有 Java 支持的 NDB Cluster,则必须在运行 CMake 时指定-DWITH_NDB_JAVA=OFF显式禁用它。否则,如果找不到 Java,则构建配置将失败。This option isONby default. If you do not wish to compile NDB Cluster with Java support, you must disable it explicitly by specifying-DWITH_NDB_JAVA=OFFwhen running CMake. Otherwise, if Java cannot be found, configuration of the build fails.-DWITH_NDB_PORT=port-DWITH_NDB_PORT=port导致 NDB Cluster 管理服务器(ndb_mgmd)默认情况下,构建为使用此
port。如果未设置此选项,默认情况下生成的管理服务器会尝试使用端口 1186。Causes the NDB Cluster management server (ndb_mgmd) that is built to use thisportby default. If this option is unset, the resulting management server tries to use port 1186 by default.-DWITH_NDB_TEST={ON|OFF}-DWITH_NDB_TEST={ON|OFF}如果启用,请包含一组 NDB API 测试程序。默认为
OFF。If enabled, include a set of NDB API test programs. The default isOFF.-DWITH_NDB_TLS_SEARCH_PATH=path-DWITH_NDB_TLS_SEARCH_PATH=path设置ndb_sign_keys 和其他用于 TLS 证书和密钥文件的
NDB程序。Set the default path searched by ndb_sign_keys and otherNDBprograms for TLS certificate and key files.Windows 平台的默认值为
$HOMEDIR/ndb-tls;对于其他平台,例如 Linux,它是$HOME/ndb-tls。The default for Windows platforms is$HOMEDIR/ndb-tls; for other platforms, such as Linux, it is$HOME/ndb-tls.