Chapter 2 Installing and Upgrading MySQL第2章:安装和升级MySQL

Table of Contents

2.1 General Installation Guidance一般安装指南
2.1.1 Supported Platforms支持的平台
2.1.2 Which MySQL Version and Distribution to Install安装哪个MySQL版本和发行版
2.1.3 How to Get MySQL如何获取MySQL
2.1.4 Verifying Package Integrity Using MD5 Checksums or GnuPG使用MD5校验和或GnuPG验证包完整性
2.1.5 Installation Layouts安装布局
2.1.6 Compiler-Specific Build Characteristics编译器特定的构建特征
2.2 Installing MySQL on Unix/Linux Using Generic Binaries使用通用二进制文件在Unix/Linux上安装MySQL
2.3 Installing MySQL on Microsoft Windows在Microsoft Windows上安装MySQL
2.3.1 MySQL Installation Layout on Microsoft WindowsMicrosoft Windows上的MySQL安装布局
2.3.2 Choosing an Installation Package选择安装包
2.3.3 MySQL Installer for Windows适用于Windows的MySQL安装程序
2.3.4 Installing MySQL on Microsoft Windows Using a noinstall ZIP Archive使用noinstall ZIP存档在Microsoft Windows上安装MySQL
2.3.5 Troubleshooting a Microsoft Windows MySQL Server InstallationMicrosoft Windows MySQL服务器安装故障排除
2.3.6 Windows Postinstallation ProceduresWindows安装后过程
2.3.7 Windows Platform RestrictionsWindows平台限制
2.4 Installing MySQL on macOS在macOS上安装MySQL
2.4.1 General Notes on Installing MySQL on macOS关于在macOS上安装MySQL的一般说明
2.4.2 Installing MySQL on macOS Using Native Packages使用本机软件包在macOS上安装MySQL
2.4.3 Installing and Using the MySQL Launch Daemon安装和使用MySQL启动守护程序
2.4.4 Installing and Using the MySQL Preference Pane安装和使用MySQL首选项窗格
2.5 Installing MySQL on Linux在Linux上安装MySQL
2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository使用MySQL Yum存储库在Linux上安装MySQL
2.5.2 Installing MySQL on Linux Using the MySQL APT Repository使用MySQL APT存储库在Linux上安装MySQL
2.5.3 Installing MySQL on Linux Using the MySQL SLES Repository使用MySQL SLES存储库在Linux上安装MySQL
2.5.4 Installing MySQL on Linux Using RPM Packages from Oracle使用Oracle的RPM包在Linux上安装MySQL
2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle使用Oracle的Debian软件包在Linux上安装MySQL
2.5.6 Deploying MySQL on Linux with Docker使用Docker在Linux上部署MySQL
2.5.7 Installing MySQL on Linux from the Native Software Repositories从本机软件存储库在Linux上安装MySQL
2.5.8 Installing MySQL on Linux with Juju使用Juju在Linux上安装MySQL
2.5.9 Managing MySQL Server with systemd用systemd管理MySQL服务器
2.6 Installing MySQL Using Unbreakable Linux Network (ULN)使用不可破坏的Linux网络(ULN)安装MySQL
2.7 Installing MySQL on Solaris在Solaris上安装MySQL
2.7.1 Installing MySQL on Solaris Using a Solaris PKG使用Solaris PKG在Solaris上安装MySQL
2.8 Installing MySQL on FreeBSD在FreeBSD上安装MySQL
2.9 Installing MySQL from Source从源代码安装MySQL
2.9.1 Source Installation Methods源安装方法
2.9.2 Source Installation Prerequisites源安装先决条件
2.9.3 MySQL Layout for Source Installation用于源代码安装的MySQL布局
2.9.4 Installing MySQL Using a Standard Source Distribution使用标准源代码发行版安装MySQL
2.9.5 Installing MySQL Using a Development Source Tree使用开发源代码树安装MySQL
2.9.6 Configuring SSL Library Support配置SSL库支持
2.9.7 MySQL Source-Configuration OptionsMySQL源配置选项
2.9.8 Dealing with Problems Compiling MySQL处理MySQL编译中的问题
2.9.9 MySQL Configuration and Third-Party ToolsMySQL配置和第三方工具
2.9.10 Generating MySQL Doxygen Documentation Content生成MySQL Doxygen文档内容
2.10 Postinstallation Setup and Testing安装后设置和测试
2.10.1 Initializing the Data Directory正在初始化数据目录
2.10.2 Starting the Server启动服务器
2.10.3 Testing the Server测试服务器
2.10.4 Securing the Initial MySQL Account保护初始MySQL帐户的安全
2.10.5 Starting and Stopping MySQL Automatically自动启动和停止MySQL
2.11 Upgrading MySQL升级MySQL
2.11.1 Before You Begin在你开始之前
2.11.2 Upgrade Paths升级路径
2.11.3 What the MySQL Upgrade Process UpgradesMySQL升级过程升级了什么
2.11.4 Changes in MySQL 8.0MySQL 8.0的变化
2.11.5 Preparing Your Installation for Upgrade准备安装以进行升级
2.11.6 Upgrading MySQL Binary or Package-based Installations on Unix/Linux在Unix/Linux上升级MySQL二进制或基于包的安装
2.11.7 Upgrading MySQL with the MySQL Yum Repository使用MySQL-Yum存储库升级MySQL
2.11.8 Upgrading MySQL with the MySQL APT Repository使用MySQL APT存储库升级MySQL
2.11.9 Upgrading MySQL with the MySQL SLES Repository使用MySQL SLES存储库升级MySQL
2.11.10 Upgrading MySQL on Windows在Windows上升级MySQL
2.11.11 Upgrading a Docker Installation of MySQL升级MySQL的Docker安装
2.11.12 Upgrade Troubleshooting升级故障排除
2.11.13 Rebuilding or Repairing Tables or Indexes重建或修复表或索引
2.11.14 Copying MySQL Databases to Another Machine将MySQL数据库复制到另一台计算机
2.12 Downgrading MySQL降级MySQL
2.13 Perl Installation NotesPerl安装说明
2.13.1 Installing Perl on Unix在Unix上安装Perl
2.13.2 Installing ActiveState Perl on Windows在Windows上安装ActiveState Perl
2.13.3 Problems Using the Perl DBI/DBD Interface使用Perl DBI/DBD接口时出现的问题

This chapter describes how to obtain and install MySQL. 本章介绍如何获取和安装MySQL。A summary of the procedure follows and later sections provide the details. 以下是程序摘要,后面的章节提供了详细信息。If you plan to upgrade an existing version of MySQL to a newer version rather than install MySQL for the first time, see Section 2.11, “Upgrading MySQL”, for information about upgrade procedures and about issues that you should consider before upgrading.如果您计划将MySQL的现有版本升级为更新版本,而不是第一次安装MySQL,请参阅第2.11节,“升级MySQL”,了解升级过程的信息和升级前应考虑的问题。

If you are interested in migrating to MySQL from another database system, see Section A.8, “MySQL 8.0 FAQ: Migration”, which contains answers to some common questions concerning migration issues.如果您对从另一个数据库系统迁移到MySQL感兴趣,请参阅A.8节,“MySQL 8.0常见问题解答:迁移”,其中包含有关迁移问题的一些常见问题的答案。

Installation of MySQL generally follows the steps outlined here:MySQL的安装通常遵循以下步骤:

  1. Determine whether MySQL runs and is supported on your platform.确定您的平台是否运行并支持MySQL。

    Please note that not all platforms are equally suitable for running MySQL, and that not all platforms on which MySQL is known to run are officially supported by Oracle Corporation. 请注意,并非所有平台都同样适合运行MySQL,而且并非所有已知运行MySQL的平台都得到Oracle Corporation的正式支持。For information about those platforms that are officially supported, see https://www.mysql.com/support/supportedplatforms/database.html on the MySQL website.有关官方支持的平台的信息,请参阅MySQL网站上的https://www.mysql.com/support/supportedplatforms/database.html

  2. Choose which distribution to install.选择要安装的发行版。

    Several versions of MySQL are available, and most are available in several distribution formats. MySQL有几个版本,大多数版本都有几种发行格式。You can choose from pre-packaged distributions containing binary (precompiled) programs or source code. 您可以从包含二进制(预编译)程序或源代码的预打包发行版中进行选择。When in doubt, use a binary distribution. 如有疑问,请使用二进制分布。Oracle also provides access to the MySQL source code for those who want to see recent developments and test new code. Oracle还为那些希望查看最新开发和测试新代码的人提供了对MySQL源代码的访问。To determine which version and type of distribution you should use, see Section 2.1.2, “Which MySQL Version and Distribution to Install”.要确定应该使用哪个版本和类型的发行版,请参阅第2.1.2节,“安装哪个MySQL版本和发行版”

  3. Download the distribution that you want to install.下载要安装的发行版。

    For instructions, see Section 2.1.3, “How to Get MySQL”. 有关说明,请参阅第2.1.3节,“如何获取MySQL”To verify the integrity of the distribution, use the instructions in Section 2.1.4, “Verifying Package Integrity Using MD5 Checksums or GnuPG”.要验证分发的完整性,请使用第2.1.4节,“使用MD5校验和或GnuPG验证包完整性”中的说明。

  4. Install the distribution.安装配线架。

    To install MySQL from a binary distribution, use the instructions in Section 2.2, “Installing MySQL on Unix/Linux Using Generic Binaries”. 要从二进制发行版安装MySQL,请使用第2.2节,“使用通用二进制文件在Unix/Linux上安装MySQL”中的说明。Alternatively, use the Secure Deployment Guide, which provides procedures for deploying a generic binary distribution of MySQL Enterprise Edition Server with features for managing the security of your MySQL installation.或者,使用《安全部署指南》,该指南提供了部署MySQL企业版服务器的通用二进制发行版的过程,该发行版具有管理MySQL安装安全性的功能。

    To install MySQL from a source distribution or from the current development source tree, use the instructions in Section 2.9, “Installing MySQL from Source”.要从源发行版或当前开发源代码树安装MySQL,请使用第2.9节,“从源代码安装MySQL”中的说明。

  5. Perform any necessary postinstallation setup.执行任何必要的安装后设置。

    After installing MySQL, see Section 2.10, “Postinstallation Setup and Testing” for information about making sure the MySQL server is working properly. 安装MySQL后,请参阅第2.10节,“安装后设置和测试”,了解有关确保MySQL服务器正常工作的信息。Also refer to the information provided in Section 2.10.4, “Securing the Initial MySQL Account”. 另请参阅第2.10.4节,“保护初始MySQL帐户”中提供的信息。This section describes how to secure the initial MySQL root user account, which has no password until you assign one. 本节介绍如何保护初始MySQLroot用户帐户的安全,该帐户在分配密码之前没有密码。The section applies whether you install MySQL using a binary or source distribution.本节适用于使用二进制或源发行版安装MySQL。

  6. If you want to run the MySQL benchmark scripts, Perl support for MySQL must be available. 如果要运行MySQL基准脚本,必须提供对MySQL的Perl支持。See Section 2.13, “Perl Installation Notes”.请参阅第2.13节,“Perl安装说明”

Instructions for installing MySQL on different platforms and environments is available on a platform by platform basis:有关在不同平台和环境上安装MySQL的说明可按平台提供:

2.1 General Installation Guidance
2.2 Installing MySQL on Unix/Linux Using Generic Binaries
2.3 Installing MySQL on Microsoft Windows
2.4 Installing MySQL on macOS
2.5 Installing MySQL on Linux
2.6 Installing MySQL Using Unbreakable Linux Network (ULN)
2.7 Installing MySQL on Solaris
2.8 Installing MySQL on FreeBSD
2.9 Installing MySQL from Source
2.10 Postinstallation Setup and Testing
2.11 Upgrading MySQL
2.12 Downgrading MySQL
2.13 Perl Installation Notes