8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 2 安装 MySQL / 2.8 从源安装 MySQL / 2.8.5 使用开发源代码树安装 MySQL
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.8.5 使用开发源代码树安装 MySQL2.8.5 Installing MySQL Using a Development Source Tree

本节介绍如何从最新的开发源代码安装 MySQL,该源代码托管在 GitHub 上。要从此存储库托管服务获取 MySQL Server 源代码,您可以设置本地 MySQL Git 存储库。This section describes how to install MySQL from the latest development source code, which is hosted on GitHub. To obtain the MySQL Server source code from this repository hosting service, you can set up a local MySQL Git repository.

在 GitHub 上,可以在 MySQL 页面上找到 MySQL Server 和其他 MySQL 项目。 MySQL Server 项目是一个包含多个 MySQL 系列分支的存储库。On GitHub, MySQL Server and other MySQL projects are found on the MySQL page. The MySQL Server project is a single repository that contains branches for several MySQL series.

从开发源安装的先决条件Prerequisites for Installing from Development Source

要从开发源树安装 MySQL,您的系统必须满足 第 2.8.2 节 “源”中列出的工具要求安装先决条件”。To install MySQL from a development source tree, your system must satisfy the tool requirements listed at Section 2.8.2, “Source Installation Prerequisites”.

设置 MySQL Git 存储库Setting Up a MySQL Git Repository

要在您的计算机上设置 MySQL Git 存储库:To set up a MySQL Git repository on your machine:

  1. 将 MySQL Git 存储库克隆到您的计算机。以下命令将 MySQL Git 存储库克隆到名为 mysql-server 的目录。初始下载可能需要一些时间才能完成,具体取决于您的连接速度。Clone the MySQL Git repository to your machine. The following command clones the MySQL Git repository to a directory named mysql-server. The initial download may take some time to complete, depending on the speed of your connection.

    $> git clone https://github.com/mysql/mysql-server.git
    Cloning into 'mysql-server'...
    remote: Counting objects: 1198513, done.
    remote: Total 1198513 (delta 0), reused 0 (delta 0), pack-reused 1198513
    Receiving objects: 100% (1198513/1198513), 1.01 GiB | 7.44 MiB/s, done.
    Resolving deltas: 100% (993200/993200), done.
    Checking connectivity... done.
    Checking out files: 100% (25510/25510), done.
    
  2. 克隆操作完成后,本地 MySQL Git 存储库的内容将类似于以下内容:When the clone operation completes, the contents of your local MySQL Git repository appear similar to the following:

    ~> cd mysql-server
    ~/mysql-server> ls
    client             extra                mysys              storage
    cmake              include              packaging          strings
    CMakeLists.txt     INSTALL              plugin             support-files
    components         libbinlogevents      README             testclients
    config.h.cmake     libchangestreams     router             unittest
    configure.cmake    libmysql             run_doxygen.cmake  utilities
    Docs               libservices          scripts            VERSION
    Doxyfile-ignored   LICENSE              share              vio
    Doxyfile.in        man                  sql                win
    doxygen_resources  mysql-test           sql-common
    
  3. 使用 gitbranch -r 命令查看 MySQL 存储库的远程跟踪分支。Use the git branch -r command to view the remote tracking branches for the MySQL repository.

    ~/mysql-server> git branch -r
      origin/5.7
      origin/8.0
      origin/HEAD -> origin/trunk
      origin/cluster-7.4
      origin/cluster-7.5
      origin/cluster-7.6
      origin/trunk
    
  4. 要查看在本地存储库中签出的分支,请发出 git 分支命令。当您克隆 MySQL Git 存储库时,会自动检出最新的 MySQL 分支。星号标识活动分支。To view the branch that is checked out in your local repository, issue the git branch command. When you clone the MySQL Git repository, the latest MySQL branch is checked out automatically. The asterisk identifies the active branch.

    ~/mysql-server$ git branch
    * trunk
    
  5. 要签出早期的 MySQL 分支,请运行 git checkout 命令,并指定分支名称。例如,要查看 MySQL 8.0 分支:To check out an earlier MySQL branch, run the git checkout command, specifying the branch name. For example, to check out the MySQL 8.0 branch:

    ~/mysql-server$ git checkout 8.0
    Checking out files: 100% (9600/9600), done.
    Branch 8.0 set up to track remote branch 8.0 from origin.
    Switched to a new branch '8.0'
    
  6. 要获取初始设置 MySQL Git 存储库后所做的更改,请切换到要更新的分支并发出 git pull 命令:To obtain changes made after your initial setup of the MySQL Git repository, switch to the branch you want to update and issue the git pull command:

    ~/mysql-server$ git checkout trunk
    ~/mysql-server$ git pull
    

    要检查提交历史记录,请使用 git log 命令:To examine the commit history, use the git log command:

    ~/mysql-server$ git log
    

    您还可以浏览提交历史记录以及 GitHub MySQL 站点上的源代码。You can also browse commit history and source code on the GitHub MySQL site.

    如果您看到更改或对代码有疑问,请在 MySQL Community Slack 上提问。If you see changes or code that you have a question about, ask on MySQL Community Slack.

  7. 克隆 MySQL Git 存储库并签出要构建的分支后,您可以从源代码构建 MySQL Server。 第 2.8.4 节“使用标准源代码发行版安装 MySQL” 中提供了相关说明,但您需要跳过有关获取和解压发行版的部分。After you have cloned the MySQL Git repository and have checked out the branch you want to build, you can build MySQL Server from the source code. Instructions are provided in Section 2.8.4, “Installing MySQL Using a Standard Source Distribution”, except that you skip the part about obtaining and unpacking the distribution.

    Be careful about installing a build from a distribution source tree on a production machine. The installation command may overwrite your live release installation. If you already have MySQL installed and do not want to overwrite it, run CMake with values for the CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT,以及MYSQL_UNIX_ADDR options different from those used by your production server. For additional information about preventing multiple servers from interfering with each other, see Section 7.8, “Running Multiple MySQL Instances on One Machine”.Be careful about installing a build from a distribution source tree on a production machine. The installation command may overwrite your live release installation. If you already have MySQL installed and do not want to overwrite it, run CMake with values for the CMAKE_INSTALL_PREFIX, MYSQL_TCP_PORT, and MYSQL_UNIX_ADDR options different from those used by your production server. For additional information about preventing multiple servers from interfering with each other, see Section 7.8, “Running Multiple MySQL Instances on One Machine”.

    努力使用新安装。例如,尝试让新功能崩溃。首先运行进行测试。请参阅 MySQL 测试套件。Play hard with your new installation. For example, try to make new features crash. Start by running make test. See The MySQL Test Suite.