8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 92%

15.7.5 CLONE 语句15.7.5 CLONE Statement

CLONE clone_action

clone_action: {
    LOCAL DATA DIRECTORY [=] 'clone_dir';
  | INSTANCE FROM 'user'@'host':port
    IDENTIFIED BY 'password'
    [DATA DIRECTORY [=] 'clone_dir']
    [REQUIRE [NO] SSL]
}

CLONE 语句用于本地或远程 MySQL 服务器实例的数据克隆。要使用 CLONE 语法,必须安装 clone 插件。参见 第 7.6.7 节,“The Clone Plugin”。The CLONE statement is used to clone data locally or from a remote MySQL server instance. To use CLONE syntax, the clone plugin must be installed. See Section 7.6.7, “The Clone Plugin”.

CLONE LOCAL DATA DIRECTORY 语法 将本地 MySQL 数据目录的数据克隆到同一服务器或节点上运行 MySQL 服务器实例的目录。'clone_dir' 目录是数据被克隆到的本地目录的完整路径。需要绝对路径。指定的目录不存在,但指定的路径必须是存在的路径。MySQL 服务器需要必要的写权限来创建指定的目录。更多信息请参见 第 7.6.7.2 节,“本地克隆数据”。CLONE LOCAL DATA DIRECTORY syntax clones data from the local MySQL data directory to a directory on the same server or node where the MySQL server instance runs. The 'clone_dir' directory is the full path of the local directory that data is cloned to. An absolute path is required. The specified directory must not exist, but the specified path must be an existent path. The MySQL server requires the necessary write access to create the specified directory. For more information, see Section 7.6.7.2, “Cloning Data Locally”.

CLONE INSTANCE syntax clones data from a remote MySQL server instance (the donor) and transfers it to the MySQL instance where the cloning operation was initiated (the recipient).

  • user 是捐赠者 MySQL 服务器实例上的克隆用户。user is the clone user on the donor MySQL server instance.

  • host 是 hostname 地址,属于捐赠者 MySQL 服务器实例。不支持互联网协议版本 6(IPv6)地址格式。可以使用 IPv6 地址的别名。IPv4 地址也可以直接使用。host is the hostname address of the donor MySQL server instance. Internet Protocol version 6 (IPv6) address format is not supported. An alias to the IPv6 address can be used instead. An IPv4 address can be used as is.

  • port是供体 MySQL 服务器实例的 port号。(不支持由 mysqlx_port。通过 MySQL Router 连接捐赠者 MySQL 服务器实例也不支持。)port is the port number of the donor MySQL server instance. (The X Protocol port specified by mysqlx_port is not supported. Connecting to the donor MySQL server instance through MySQL Router is also not supported.)

  • IDENTIFIED BY 'password' 指定了 Clone 用户在 MySQL 服务器实例上的密码。IDENTIFIED BY 'password' specifies the password of the clone user on the donor MySQL server instance.

  • DATA DIRECTORY [=] 'clone_dir'是一个可选子句,用于指定接收方的数据克隆目录。如果您不想删除接收方数据目录中现有的数据,请使用此选项。需要提供绝对路径,并且目录必须不存在。MySQL 服务器必须具有创建该目录的必要写入权限。DATA DIRECTORY [=] 'clone_dir' is an optional clause used to specify a directory on the recipient for the data you are cloning. Use this option if you do not want to remove existing data in the recipient data directory. An absolute path is required, and the directory must not exist. The MySQL server must have the necessary write access to create the directory.

    当未使用可选的 DATA DIRECTORY [=] 'clone_dir' 子句时,克隆操作会移除接收数据目录中的现有数据,用克隆数据替换,并自动重启服务器。When the optional DATA DIRECTORY [=] 'clone_dir' clause is not used, a cloning operation removes existing data in the recipient data directory, replaces it with the cloned data, and automatically restarts the server afterward.

  • [REQUIRE [NO] SSL] 明确指定在通过网络传输克隆数据时是否使用加密连接。如果无法满足显式规格,会返回错误。如果未指定 SSL 条款,克隆会默认尝试建立加密连接,若安全连接尝试失败,则退回到不安全的连接。无论是否指定该条款,克隆加密数据时都需要安全连接。更多信息请参见 配置加密连接用于克隆“。[REQUIRE [NO] SSL] explicitly specifies whether an encrypted connection is to be used or not when transferring cloned data over the network. An error is returned if the explicit specification cannot be satisfied. If an SSL clause is not specified, clone attempts to establish an encrypted connection by default, falling back to an insecure connection if the secure connection attempt fails. A secure connection is required when cloning encrypted data regardless of whether this clause is specified. For more information, see Configuring an Encrypted Connection for Cloning.

有关从远程 MySQL 服务器实例克隆数据的更多信息,请参见 第 7.6.7.3 节,”克隆远程数据“。For additional information about cloning data from a remote MySQL server instance, see Section 7.6.7.3, “Cloning Remote Data”.