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.tarMVER是 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 ofmysql-server_.MVER-DVER_CPU.deb-bundle.tarMVERis the MySQL version andDVERis the Linux distribution version. TheCPUvalue 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值CPUValue预期处理器类型或系列Intended Processor Type or Family i386i386Pentium 处理器或更好,32 位Pentium processor or better, 32 bit amd64amd6464 位 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 thelibaiolibrary 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 ; 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 withserver-coreandclient-corein 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 (likemy.cnf) are under/etc/mysql所有二进制文件、库、头文件等均位于
/usr/bin和/usr/sbinAll binaries, libraries, headers, etc., are under/usr/binand/usr/sbin数据目录位于
/var/lib/mysqlThe data directory is under/var/lib/mysql
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.