8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

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

34.4 连接34.4 Connecting

本节描述了连接到部署在 OCI 计算实例上的 MySQL 服务器的各种连接方法。This section describes the various connection methods for connecting to the deployed MySQL server on the OCI Compute Instance.

使用 SSH 连接Connecting with SSH

本节提供了一些关于从类 UNIX 平台连接到 OCI 计算的详细信息。有关使用 SSH 连接的更多信息,请参见 使用 SSH 访问 Oracle Linux 实例 和 连接到您的实例。This section gives some detail on connecting from a UNIX-like platform to the OCI Compute. For more information on connecting with SSH, see Accessing an Oracle Linux Instance Using SSH and Connecting to Your Instance.

要使用 SSH 连接到在计算实例上运行的 Oracle Linux,请运行以下命令:To connect to the Oracle Linux running on the Compute Instance with SSH, run the following command:

ssh opc@computeIP

其中 opc 是计算用户,computeIP 是您的计算实例的 IP 地址。where opc is the compute user and computeIP is the IP address of your Compute Instance.

要查找为 root 用户创建的临时 root 密码,请运行以下命令:To find the temporary root password created for the root user, run the following command:

sudo grep 'temporary password' /var/log/mysqld.log

要更改默认密码,请使用生成的临时密码登录服务器,使用以下命令:mysql -uroot -p。然后运行以下命令:To change your default password, log in to the server using the generated, temporary password, using the following command: mysql -uroot -p. Then run the following:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

使用 MySQL 客户端连接Connecting with MySQL Client

Note

要从本地 MySQL 客户端连接,必须首先在 MySQL 服务器上创建一个允许远程登录的用户。To connect from your local MySQL client, you must first create on the MySQL server a user which allows remote login.

要从本地 MySQL 客户端连接到 MySQL 服务器,请在 shell 会话中运行以下命令:To connect to the MySQL Server from your local MySQL client, run the following command from your shell session:

mysql -uroot -p -hcomputeIP

其中 computeIP 是计算实例的 IP 地址。where computeIP is the IP address of your Compute Instance.

使用 MySQL Shell 连接Connecting with MySQL Shell

要从本地 MySQL Shell 连接到 MySQL 服务器,请运行以下命令以启动 shell 会话:To connect to the MySQL Server from your local MySQL Shell, run the following command to start your shell session:

mysqlsh root@computeIP

其中 computeIP 是计算实例的 IP 地址。where computeIP is the IP address of your Compute Instance.

有关 MySQL Shell 连接的更多信息,请参见 MySQL Shell 连接。For more information on MySQL Shell connections, see MySQL Shell Connections.

使用 Workbench 连接Connecting with Workbench

要从 MySQL Workbench 连接到 MySQL 服务器,请参见 MySQL Workbench 中的连接。To connect to the MySQL Server from MySQL Workbench, see Connections in MySQL Workbench.