## 模块 4：连接到 TiDB 实例

### 步骤 1. 从远程 Linux 连接到 TiDB 实例

+ 从连接到远程 Linux 的 SSH 会话中，连接到 TiDB 实例并修改密码。如果 `root` 有密码，你应提供 `-p` 选项，否则可以省略 `-p` 选项。

   ```bash
   mysql -h ${HOST_DB1_PRIVATE_IP} --port 4000 -u root
   ```

   ```output
   mysql>
   ```

### 步骤 2. 执行 SQL 查询

+ 检查 TiDB 集群的版本。

  ```sql
  SELECT TIDB_VERSION(), VERSION(), NOW()\G
  ```

  ```output
  *************************** 1. row ***************************
  TIDB_VERSION(): Release Version: v8.1.1
  Edition: Community
  Git Commit Hash: a7df4f9845d5d6a590c5d45dad0dcc9f21aa8765
  Git Branch: HEAD
  UTC Build Time: 2024-08-22 05:50:03
  GoVersion: go1.21.13
  Race Enabled: false
  Check Table Before Drop: false
  Store: tikv
       VERSION(): 8.0.11-TiDB-v8.1.1
           NOW(): 2025-01-19 14:20:05
  1 row in set (0.00 sec)
  ```

### 步骤 3. 从 mysql 客户端退出到 Linux 提示符

   ```sql
   EXIT;
   ```

   ```output
   Bye
   ```
