从源代码安装 MySQL 需要进行多次开发工具。无论您使用标准源代码分发还是开发源代码树,都需要其中一些工具。其他工具要求取决于您使用的安装方法。Installation of MySQL from source requires several development tools. Some of these tools are needed no matter whether you use a standard source distribution or a development source tree. Other tool requirements depend on which installation method you use.
要从源代码安装 MySQL,无论采用哪种安装方法,都必须满足以下系统要求:To install MySQL from source, the following system requirements must be satisfied, regardless of installation method:
CMake,它在所有平台上用作构建框架。 CMake 可以从 http://www.cmake.org 下载。CMake, which is used as the build framework on all platforms. CMake can be downloaded from http://www.cmake.org.
一个好的 make 程序。尽管某些平台带有自己的 make 实现,但强烈建议您使用 GNU make 3.75 或更高版本。它可能已经在您的系统上以 gmake 的形式提供。 GNU make 可从 http://www.gnu.org/software/make/ 获取。A good make program. Although some platforms come with their own make implementations, it is highly recommended that you use GNU make 3.75 or later. It may already be available on your system as gmake. GNU make is available from http://www.gnu.org/software/make/.
在类 Unix 系统(包括 Linux)上,您可以检查系统的 make 版本像这样:On Unix-like systems, including Linux, you can check your system's version of make like this:
$>
make --versionGNU Make 4.2.1MySQL 8.4 源代码允许使用 C++17 功能。为了在所有受支持的平台上启用必要级别的 C++17 支持,需要使用以下最低编译器版本:MySQL 8.4 source code permits use of C++17 features. To enable the necessary level of C++17 support across all supported platforms, the following minimum compiler versions apply:
Linux:GCC 10 或 Clang 12Linux: GCC 10 or Clang 12
macOS:XCode 10macOS: XCode 10
Solaris:(MySQL 8.4.4 之前)GCC 10; (MySQL 8.4.4 及更高版本)GCC 11.4Solaris: (Prior to MySQL 8.4.4) GCC 10; (MySQL 8.4.4 and later) GCC 11.4
Windows:Visual Studio 2019Windows: Visual Studio 2019
在 Windows 上构建 MySQL 需要 Windows 版本 10 或更高版本。 (在最新版本的 Windows 上构建的 MySQL 二进制文件通常可以在旧版本上运行。)您可以通过在 Windows 命令提示符中执行 WMIC.exe os get version 来确定 Windows 版本。Building MySQL on Windows requires Windows version 10 or later. (MySQL binaries built on recent versions of Windows can generally be run on older versions.) You can determine the Windows version by executing WMIC.exe os get version in the Windows Command Prompt.
MySQL C API 需要 C++ 或 C99 编译器来编译。The MySQL C API requires a C++ or C99 compiler to compile.
需要 SSL 库来支持加密连接、随机数生成的熵以及其他与加密相关的操作。默认情况下,构建使用主机系统上安装的 OpenSSL 库。要显式指定库,请在调用 CMake 时使用
WITH_SSL选项。有关更多信息,请参阅第 2.8.6 节“配置 SSL 库支持”。An SSL library is required for support of encrypted connections, entropy for random number generation, and other encryption-related operations. By default, the build uses the OpenSSL library installed on the host system. To specify the library explicitly, use theWITH_SSLoption when you invoke CMake. For additional information, see Section 2.8.6, “Configuring SSL Library Support”.构建 MySQL(但不使用它)需要 Boost C++ 库。在 MySQL 8.3 及更高版本中,这些库始终与 MySQL 源捆绑在一起。The Boost C++ libraries are required to build MySQL (but not to use it). In MySQL 8.3 and later, these libraries are always bundled with the MySQL source.
足够的可用内存。如果您在编译大型源文件时遇到诸如内部编译器错误之类的构建错误,则可能是您的内存太少了。如果在虚拟机上编译,请尝试增加内存分配。Sufficient free memory. If you encounter build errors such as internal compiler error when compiling large source files, it may be that you have too little memory. If compiling on a virtual machine, try increasing the memory allocation.
如果您打算运行测试脚本,则需要 Perl。大多数类 Unix 系统都包含 Perl。对于 Windows,您可以使用 ActiveState Perl。或 Strawberry Perl。Perl is needed if you intend to run test scripts. Most Unix-like systems include Perl. For Windows, you can use ActiveState Perl. or Strawberry Perl.
要从标准源发行版安装 MySQL,需要使用以下工具之一来解压缩发行版文件:To install MySQL from a standard source distribution, one of the following tools is required to unpack the distribution file:
对于
.tar.gz压缩的 tar 文件:GNUgunzip来解压缩发行版,并使用合理的 tar 来解压它。如果您的 tar 程序支持z选项,则它既可以解压缩文件,也可以解压文件。For a.tar.gzcompressed tar file: GNUgunzipto uncompress the distribution and a reasonable tar to unpack it. If your tar program supports thezoption, it can both uncompress and unpack the file.GNU tar is known to work. The standard tar provided with some operating systems is not able to unpack the long file names in the MySQL distribution. You should download and install GNU tar, or if available, use a preinstalled version of GNU tar. Usually this is available as gnutar, gtar, or as tar within a GNU or Free Software directory, such as
/usr/sfw/bin或者/usr/local/bin. GNU tar is available from https://www.gnu.org/software/tar/.GNU tar is known to work. The standard tar provided with some operating systems is not able to unpack the long file names in the MySQL distribution. You should download and install GNU tar, or if available, use a preinstalled version of GNU tar. Usually this is available as gnutar, gtar, or as tar within a GNU or Free Software directory, such as/usr/sfw/binor/usr/local/bin. GNU tar is available from https://www.gnu.org/software/tar/.对于
.zipZip 存档:WinZip 或其他可以读取.zip文件的工具。For a.zipZip archive: WinZip or another tool that can read.zipfiles.对于
.rpmRPM 包:用于构建发行版解包的 rpmbuild 程序For an.rpmRPM package: The rpmbuild program used to build the distribution unpacks it.
要从开发源代码树安装 MySQL,需要以下附加工具:To install MySQL from a development source tree, the following additional tools are required:
需要 Git 版本控制系统来获取开发源代码。 GitHub 帮助提供了在不同平台上下载和安装 Git 的说明。The Git revision control system is required to obtain the development source code. GitHub Help provides instructions for downloading and installing Git on different platforms.
bison 2.1 或更高版本,可从 http://www.gnu.org/software/bison/。 (不再支持版本 1。)尽可能使用最新版本的 bison;如果遇到问题,请升级到更高版本,而不是恢复到早期版本。bison 2.1 or later, available from http://www.gnu.org/software/bison/. (Version 1 is no longer supported.) Use the latest version of bison where possible; if you experience problems, upgrade to a later version, rather than revert to an earlier one.
bison 可从 http://www.gnu.org/software/bison/ 获取。 Windows 版
bison可以从 http://gnuwin32.sourceforge.net/packages/bison.htm 下载。下载标有“完整包,不包括来源”的包。在 Windows 上,bison 的默认位置是C:\Program Files\GnuWin32目录。由于目录名称中存在空格,某些实用程序可能无法找到 bison。此外,如果路径中存在空格,Visual Studio 可能会挂起。您可以通过安装到不包含空格的目录(例如C:\GnuWin32)来解决这些问题。bison is available from http://www.gnu.org/software/bison/.bisonfor Windows can be downloaded from http://gnuwin32.sourceforge.net/packages/bison.htm. Download the package labeled “Complete package, excluding sources”. On Windows, the default location for bison is theC:\Program Files\GnuWin32directory. Some utilities may fail to find bison because of the space in the directory name. Also, Visual Studio may simply hang if there are spaces in the path. You can resolve these problems by installing into a directory that does not contain a space (for exampleC:\GnuWin32).在 Solaris Express 上,除了 bison 之外,还必须安装 m4。 m4 可从 http://www.gnu.org/software/m4/ 获取。On Solaris Express, m4 must be installed in addition to bison. m4 is available from http://www.gnu.org/software/m4/.
如果您必须安装任何程序,请修改您的 PATH 环境变量以包含程序所在的任何目录。请参阅第 6.2.9 节“设置环境变量”。If you have to install any programs, modify your
PATH environment variable to include any
directories in which the programs are located. See
Section 6.2.9, “Setting Environment Variables”.
如果您遇到问题并需要提交错误报告,请使用第 1.6 节“如何报告错误或问题”。If you run into problems and need to file a bug report, please use the instructions in Section 1.6, “How to Report Bugs or Problems”.