文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 2 安装 MySQL / 2.5 在 Linux 上安装 MySQL / 2.5.5 使用 Oracle 的 Debian 软件包在 Linux 上安装 MySQL
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.5.5 使用 Oracle 的 Debian 软件包在 Linux 上安装 MySQL2.5.5 Installing MySQL on Linux Using Debian Packages from Oracle

Oracle 提供了 Debian 软件包,用于在 Debian 或类 Debian Linux 系统上安装 MySQL。这些软件包可通过两个不同的渠道获得:Oracle provides Debian packages for installing MySQL on Debian or Debian-like Linux systems. The packages are available through two different channels:

  • MySQL APT 存储库。这是在类似 Debian 的系统上安装 MySQL 的首选方法,因为它提供了一种简单方便的方法来安装和更新 MySQL 产品。有关详细信息,请参阅第 2.5.2 节 “使用 MySQL APT 存储库在 Linux 上安装 MySQL”。The MySQL APT Repository. This is the preferred method for installing MySQL on Debian-like systems, as it provides a simple and convenient way to install and update MySQL products. For details, see Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository”.

  • MySQL 开发者专区的下载区域。有关详细信息,请参阅第 2.1.3 节“如何获取 MySQL”。以下是有关可用 Debian 软件包的一些信息以及安装说明:The MySQL Developer Zone's Download Area. For details, see Section 2.1.3, “How to Get MySQL”. The following are some information on the Debian packages available there and the instructions for installing them:

    • MySQL 开发人员专区中提供了各种 Debian 软件包,用于在当前 Debian 和 Ubuntu 平台上安装 MySQL 的不同组件。首选方法是使用 tarball 包,其中包含 MySQL 基本设置所需的包。 tarball 包的名称格式为 mysql-server_MVER-DVER_CPU.deb-bundle.tar。 MVER 是 MySQL 版本,DVER 是 Linux 发行版。 CPU 值表示构建软件包所针对的处理器类型或系列,如下表所示:Various Debian packages are provided in the MySQL Developer Zone for installing different components of MySQL on the current Debian and Ubuntu platforms. The preferred method is to use the tarball bundle, which contains the packages needed for a basic setup of MySQL. The tarball bundles have names in the format of mysql-server_MVER-DVER_CPU.deb-bundle.tar. MVER is the MySQL version and DVER is the Linux distribution version. The CPU value indicates the processor type or family for which the package is built, as shown in the following table:

      表 2.14 MySQL Debian 和 Ubuntu 安装包 CPU 标识符Table 2.14 MySQL Debian and Ubuntu Installation Packages CPU Identifiers

      CPU 值CPU Value 预期处理器类型或系列Intended Processor Type or Family
      i386i386 Pentium 处理器或更好,32 位Pentium processor or better, 32 bit
      amd64amd64 64 位 x86 处理器64-bit x86 processor

    • 下载 tarball 后,使用以下命令将其解压:After downloading the tarball, unpack it with the following command:

      $> tar -xvf mysql-server_MVER-DVER_CPU.deb-bundle.tar
      
    • 如果您的系统上还没有 libaio 库,您可能需要安装它: You may need to install the libaio library if it is not already present on your system:

      $> sudo apt-get install libaio1
      
    • 使用以下命令预配置 MySQL 服务器包:Preconfigure the MySQL server package with the following command:

      $> sudo dpkg-preconfigure mysql-community-server_*.deb
      

      系统会要求您提供 MySQL 安装的 root 用户的密码。可能还会询问您有关安装的其他问题。You are asked to provide a password for the root user for your MySQL installation. You might also be asked other questions regarding the installation.

      Important

      确保记住您设置的 root 密码。如果用户想稍后设置密码,可以将对话框中的密码字段留空,然后按确定即可;在这种情况下,对于使用 Unix 套接字文件的连接,使用 MySQL Socket Peer-Credential Authentication Plugin 对服务器的 root 访问进行身份验证。您可以稍后使用 mysql_secure_installation 设置 root 密码。 Make sure you remember the root password you set. Users who want to set a password later can leave the password field blank in the dialogue box and just press OK; in that case, root access to the server is authenticated using the MySQL Socket Peer-Credential Authentication Plugin for connections using a Unix socket file. You can set the root password later using mysql_secure_installation.

    • 对于 MySQL 服务器的基本安装,请安装数据库公共文件包、客户端包、客户端元包、服务器包和服务器元包(按顺序);您可以使用单个命令来完成此操作:For a basic installation of the MySQL server, install the database common files package, the client package, the client metapackage, the server package, and the server metapackage (in that order); you can do that with a single command:

      $> sudo dpkg -i mysql-{common,community-client-plugins,community-client-core,community-client,client,community-server-core,community-server,server}_*.deb
      

      还有一些包名称中带有 server-core 和 client-core 的包。它们仅包含二进制文件,并由标准包自动安装。单独安装它们不会导致 MySQL 设置正常运行。There are also packages with server-core and client-core in the package names. These contain binaries only and are installed automatically by the standard packages. Installing them by themselves does not result in a functioning MySQL setup.

      如果 dpkg(例如 libmecab2)警告您未满足的依赖项,您可以使用 apt-get 修复它们:If you are being warned of unmet dependencies by dpkg (such as libmecab2), you can fix them using apt-get:

      sudo apt-get -f install

      以下是文件在系统上的安装位置:Here are where the files are installed on the system:

      • 所有配置文件(例如 my.cnf)都位于 /etc/mysqlAll configuration files (like my.cnf) are under /etc/mysql

      • 所有二进制文件、库、头文件等均位于 /usr/bin 和 /usr/sbinAll binaries, libraries, headers, etc., are under /usr/bin and /usr/sbin

      • 数据目录位于 /var/lib/mysqlThe data directory is under /var/lib/mysql

Note

MySQL 的 Debian 发行版也由其他供应商提供。请注意,它们在特性、功能和约定(包括通信设置)方面可能与 Oracle 构建的产品不同,并且本手册中的说明不一定适用于安装它们。应参阅供应商的说明。Debian distributions of MySQL are also provided by other vendors. Be aware that they may differ from those built by Oracle in features, capabilities, and conventions (including communication setup), and that the instructions in this manual do not necessarily apply to installing them. The vendor's instructions should be consulted instead.