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

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 2 安装 MySQL / 2.5 在 Linux 上安装 MySQL / 2.5.7 从本机软件存储库在 Linux 上安装 MySQL
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

2.5.7 从本机软件存储库在 Linux 上安装 MySQL2.5.7 Installing MySQL on Linux from the Native Software Repositories

许多 Linux 发行版在其本机软件存储库中包含 MySQL 服务器版本、客户端工具和开发组件,并且可以使用平台的标准包管理进行安装系统。本节提供使用这些包管理系统安装 MySQL 的基本说明。Many Linux distributions include a version of the MySQL server, client tools, and development components in their native software repositories and can be installed with the platforms' standard package management systems. This section provides basic instructions for installing MySQL using those package management systems.

Important

本机包通常比当前可用版本落后几个版本。您通常也无法安装开发里程碑版本 (DMR),因为这些版本通常在本机存储库中不可用。在继续之前,我们建议您查看第 2.5 节“在 Linux 上安装 MySQL” 中描述的其他安装选项。Native packages are often several versions behind the currently available release. You are also normally unable to install development milestone releases (DMRs), since these are not usually made available in the native repositories. Before proceeding, we recommend that you check out the other installation options described in Section 2.5, “Installing MySQL on Linux”.

分发版具体说明如下所示:Distribution specific instructions are shown below:

  • Red Hat Linux、Fedora、CentOSRed Hat Linux, Fedora, CentOS

    Note

    对于许多 Linux 发行版,您可以使用 MySQL Yum 存储库而不是平台的本机软件存储库来安装 MySQL。有关详细信息,请参阅第 2.5.1 节“使用 MySQL Yum 存储库在 Linux 上安装 MySQL”。For a number of Linux distributions, you can install MySQL using the MySQL Yum repository instead of the platform's native software repository. See Section 2.5.1, “Installing MySQL on Linux Using the MySQL Yum Repository” for details.

    对于 Red Hat 和类似发行版,MySQL 发行版分为许多单独的软件包,mysql 用于客户端工具, mysql-server 用于服务器和相关工具,mysql-libs 用于库。如果您想要提供来自不同语言和环境(例如 Perl、Python 等)的连接,则需要这些库。For Red Hat and similar distributions, the MySQL distribution is divided into a number of separate packages, mysql for the client tools, mysql-server for the server and associated tools, and mysql-libs for the libraries. The libraries are required if you want to provide connectivity from different languages and environments such as Perl, Python and others.

    要安装,请使用 yum 命令指定要安装的软件包。例如:To install, use the yum command to specify the packages that you want to install. For example:

    #> yum install mysql mysql-server mysql-libs mysql-server
    Loaded plugins: presto, refresh-packagekit
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql.x86_64 0:5.1.48-2.fc13 set to be updated
    ---> Package mysql-libs.x86_64 0:5.1.48-2.fc13 set to be updated
    ---> Package mysql-server.x86_64 0:5.1.48-2.fc13 set to be updated
    --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.48-2.fc13.x86_64
    --> Running transaction check
    ---> Package perl-DBD-MySQL.x86_64 0:4.017-1.fc13 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package               Arch          Version               Repository      Size
    ================================================================================
    Installing:
     mysql                 x86_64        5.1.48-2.fc13         updates        889 k
     mysql-libs            x86_64        5.1.48-2.fc13         updates        1.2 M
     mysql-server          x86_64        5.1.48-2.fc13         updates        8.1 M
    Installing for dependencies:
     perl-DBD-MySQL        x86_64        4.017-1.fc13          updates        136 k
    
    Transaction Summary
    ================================================================================
    Install       4 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 10 M
    Installed size: 30 M
    Is this ok [y/N]: y
    Downloading Packages:
    Setting up and reading Presto delta metadata
    Processing delta metadata
    Package(s) data still to download: 10 M
    (1/4): mysql-5.1.48-2.fc13.x86_64.rpm                    | 889 kB     00:04
    (2/4): mysql-libs-5.1.48-2.fc13.x86_64.rpm               | 1.2 MB     00:06
    (3/4): mysql-server-5.1.48-2.fc13.x86_64.rpm             | 8.1 MB     00:40
    (4/4): perl-DBD-MySQL-4.017-1.fc13.x86_64.rpm            | 136 kB     00:00
    --------------------------------------------------------------------------------
    Total                                           201 kB/s |  10 MB     00:52
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : mysql-libs-5.1.48-2.fc13.x86_64                          1/4
      Installing     : mysql-5.1.48-2.fc13.x86_64                               2/4
      Installing     : perl-DBD-MySQL-4.017-1.fc13.x86_64                       3/4
      Installing     : mysql-server-5.1.48-2.fc13.x86_64                        4/4
    
    Installed:
      mysql.x86_64 0:5.1.48-2.fc13            mysql-libs.x86_64 0:5.1.48-2.fc13
      mysql-server.x86_64 0:5.1.48-2.fc13
    
    Dependency Installed:
      perl-DBD-MySQL.x86_64 0:4.017-1.fc13
    
    Complete!
    

    MySQL 和 MySQL 服务器现在应该已安装。示例配置文件安装到 /etc/my.cnf 中。要启动 MySQL 服务器,请使用 systemctl:MySQL and the MySQL server should now be installed. A sample configuration file is installed into /etc/my.cnf. To start the MySQL server use systemctl:

    $> systemctl start mysqld
    

    如果表尚不存在,系统会自动为您创建它们。但是,您应该运行 mysql_secure_installation 在服务器上设置 root 密码。The database tables are automatically created for you, if they do not already exist. You should, however, run mysql_secure_installation to set the root passwords on your server.

  • Debian、Ubuntu、 KubuntuDebian, Ubuntu, Kubuntu

    Note

    对于受支持的 Debian 和 Ubuntu 版本,可以使用 MySQL APT 存储库(而不是平台的本机软件存储库)安装 MySQL。有关详细信息,请参阅第 2.5.2 节“使用 MySQL APT 存储库在 Linux 上安装 MySQL”。For supported Debian and Ubuntu versions, MySQL can be installed using the MySQL APT Repository instead of the platform's native software repository. See Section 2.5.2, “Installing MySQL on Linux Using the MySQL APT Repository” for details.

    在 Debian 和相关发行版上,其软件存储库中有两个 MySQL 软件包:mysql-client 和 mysql-server,分别用于客户端和服务器组件。您应该指定一个明确的版本,例如 mysql-client-5.1,以确保您安装所需的 MySQL 版本。On Debian and related distributions, there are two packages for MySQL in their software repositories, mysql-client and mysql-server, for the client and server components respectively. You should specify an explicit version, for example mysql-client-5.1, to ensure that you install the version of MySQL that you want.

    要下载并安装(包括任何依赖项),请使用 apt-get 命令,指定您要安装的软件包。To download and install, including any dependencies, use the apt-get command, specifying the packages that you want to install.

    Note

    安装之前,请确保更新您的 apt-get 索引文件,以确保您下载的是最新的可用版本。Before installing, make sure that you update your apt-get index files to ensure you are downloading the latest available version.

    Note

    apt-get 命令会安装许多软件包,包括 MySQL 服务器,以提供典型的工具和应用程序环境。这可能意味着除了主 MySQL 软件包之外,您还需要安装大量软件包。The apt-get command installs a number of packages, including the MySQL server, in order to provide the typical tools and application environment. This can mean that you install a large number of packages in addition to the main MySQL package.

    在安装过程中,将创建初始数据库,并提示您输入 MySQL root 密码(并进行确认)。配置文件在 /etc/mysql/my.cnf 中创建。初始化脚本在 /etc/init.d/mysql.During installation, the initial database is created, and you are prompted for the MySQL root password (and confirmation). A configuration file is created in /etc/mysql/my.cnf. An init script is created in /etc/init.d/mysql.

    服务器应该已经启动。您可以使用以下方式手动启动和停止服务器:The server should already be started. You can manually start and stop the server using:

    #> service mysql [start|stop]
    

    服务自动添加到 2、3 和 4 运行级别,并在单、关闭和重启级别中提供停止脚本。The service is automatically added to the 2, 3 and 4 run levels, with stop scripts in the single, shutdown and restart levels.