# Exercise 2-1: Connecting to TiDB Cloud Cluster by Standard Connection


## Overview
+ In this exercise, you connect to TiDB Cloud cluster through `Standard Connection`


## Duration
+ This exercise should take you approximately 10 minutes to complete.


## Tasks
1. On the `Clusters` page, click the name of the cluster to enter the `Overview` page of the cluster.
2. On the `Overview` page, click `Connect` in the upper-right corner.
3. Choose a connection method, and then connect to your cluster with the connection string.




## Solution Steps
(a) For `TiDB Serverless` cluster
1. On the `Clusters` page, click the name of the cluster to enter the `Overview` page of the cluster.
<img src="./diagram/GoServerlessTierOverview_aa_002_20230111.png" width="50%" align="top"/>



2. On the `Overview` page, click `Connect` in the upper-right corner.



3. In the dialog, keep the default setting of the endpoint type as Public, and choose a connection method and Operating System, then click `Create Password`. You can click `Copy password` to save your password, or you can reset it when connecting next time.
<img src="./diagram/ConnectToServerlessTier02_aa_003_20230111.png" width="50%" align="top"/>



4. Connect to your cluster with the connection string.
<img src="./diagram/ConnectToServerlessTier04_aa_001_20230111.png" width="50%" align="top"/>



(b) For `TiDB Dedicated` cluster
1. On the `Clusters` page, click the name of the cluster to enter the `Overview` page of the cluster.
<img src="./diagram/GoDedicatedTierOverview_aa_002_20230111.png" width="50%" align="top"/>



2. On the `Overview` page, Click drop-down menu in the upper-right corner, and then click `Security Settings`.
<img src="./diagram/SecuritySettings01_aa_002_20230113.png" width="50%" align="top"/>



3. In `Security Settings` window, set your `Root Password`, then click `Apply`.
<img src="./diagram/SecuritySettings02_aa_002_20230113.png" width="50%" align="top"/>



4. Back to the `Overview` page, click `Connect` in the upper-right corner.



5. In the Connect setting window, click one of the buttons to add some rules, then set the `IP Address` and `Description(Optional)`, and then click `Update Filter` to confirm the changes.
If the `traffic filter` is already set, you can edit it or skip this step.
<img src="./diagram/ConnectToDedicatedTier02_aa_002_20230111.png" width="50%" align="top"/>

<img src="./diagram/ConnectToDedicatedTier03_aa_002_20230111.png" width="50%" align="top"/>



6. Click `Download TiDB cluster CA` for TLS connection to TiDB clusters. The TiDB cluster CA supports TLS 1.2 version by default.
<img src="./diagram/ConnectToDedicatedTier04_aa_002_20230111.png" width="50%" align="top"/>



7. Choose a connection method, and then connect to your cluster with the connection string. Note that you need to use the path of the downloaded CA file as the argument of the `--ssl-ca` option in the connection string.
<img src="./diagram/ConnectToDedicatedTier05_aa_002_20230111.png" width="50%" align="top"/>




