## Module 2: Connecting to `TiDB Cloud Dedicated` Cluster

You can connect to `TiDB Cloud Dedicated` by public endpoint, private endpoint, and VPC peering. In this module, we will public endpoint.

### Step 1. Open `TiDB Cloud Dedicated` interface

+ Click the name of your `TiDB Cloud Dedicated` Cluster

  ![80%](https://lab-static.pingcap.com/images/2025/7/25/35e535664fc068aa481769714f4c6a37380cea7c.png)

### Step 2. Configure the connection

+ Click `Connect` on the upper-right corner to open the connection panel.
+ Choose `Public` as the `Connection Type`.
+ Then, click `Configure IP Access List`.

  ![80%](https://lab-static.pingcap.com/images/2025/7/25/b83385d1d9be8172d1a18a58f483be07aa35e088.png)

+ Choose `Allow access from anywhere`.
+ Then, Click `Comfirm`.

> [!TIP]
> `Allow access from anywhere` is NOT recommend in production environment.

### Step 3. Finish security settings

+ Click `Set Root Password`, and set the root password.
+ Then, download the CA certificate.

  ![80%](https://lab-static.pingcap.com/images/2025/7/25/ffac8332817e6cf89cd7b9fb4385d047c5b754c3.png)

### Step 4. Get the connection command

+ Choose Connect With `MySQL CLi`

  ![80%](https://lab-static.pingcap.com/images/2025/7/25/54f577c9682875874ebc1ff62693957f21c19a87.png)

+ Copy the connection command.

### Step 5. Open [Terminal 1](ssh://monitor1-ssh#1)

### Step 6. Copy `ca.pem`

  ```bash
  vi ca.pem
  ```

+ Then, copy the `ca.pem` contents from your local machine to [Terminal 1](ssh://monitor1-ssh#1).
+ Enter `:` + `wq!` to exit.

### Step 7. Connect to `TiDB Cloud Dedicated`

+ Paste the connection command obtained in Step 4 into the terminal.

  ```bash
  mysql --comments -u 'root' -h <host_url> -P 4000 -D 'test' --ssl-mode=VERIFY_IDENTITY --ssl-ca=/home/ubuntu/ca.pem -p'<PASSWORD>'
  ```

  ```output
  ...
  Your MySQL connection id is 227
  Server version: 8.0.11-TiDB-v8.5.2 TiDB Server (Apache License 2.0) Enterprise Edition, MySQL 8.0 compatible

  Copyright (c) 2000, 2025, Oracle and/or its affiliates.

  Oracle is a registered trademark of Oracle Corporation and/or its
  affiliates. Other names may be trademarks of their respective owners.
  ...
  ```
