Setting Up a TiDB Cloud Cluster

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiDB Could集群搭建

| username: 黑血小庆

  1. Register an account on the following website and log in, or directly use your Google/GitHub/Microsoft account to log in:

TiDB Cloud.

After logging in, you will find that a cluster has already been automatically created.
You can also click on “Clusters” on the left to create your own cluster.
After clicking in, click “Create Cluster” in the upper right corner.
Then choose the type; Serverless is free.
Choose the region (default is Tokyo).
Name the cluster; name it whatever you like.
The cluster plan explains that you can create a total of 5 free clusters, each with 5GB of storage space and 50MB of memory. You can also choose a scalable cluster, adding storage and memory at $0.24/GB and $0.12/MB.
Advanced settings are for setting up two-layer encryption, which is only available for scalable clusters. Since I chose a free cluster above, I can’t set this.
Finally, click “Create” on the right, and after a while, it will be created.
After creation, go back to the cluster to see the newly created cluster.
Click the three dots in the action column on the right of the cluster1 cluster to write SQL, import data, delete the cluster, get help, etc.
We directly click on Cluster1, which is the cluster we just manually created, and then click “Connect.”
Since this is a test, I will use Navicat to connect to the database later. The first four settings can be left as default.
Connect with: I use Navicat to connect, so I choose Navicat. If you use other tools to connect, just choose the appropriate one. If you don’t know how to use Navicat, there are many tutorials online that you can search for.
Then click the button on the right to create a password, which will be needed later when connecting.
Then click “CA cert” to download the CA certificate. Remember the path where the CA certificate is downloaded, as it will be needed later.
You can also see a bunch of database connection information below: host domain, port, username, user password (created in the previous step), database name, etc.

  1. Use Navicat to connect to the database
    Open the Navicat software; the official requirement is Navicat version 16.3.2 or above, but my Navicat is version 12.0.11, which also works.
  2. Click “Connection” in the upper left corner.
  3. Choose MySQL because TiDB encapsulates the MySQL protocol at the upper layer, making it compatible with MySQL’s protocol and SQL syntax, saving learning costs. MySQL can be directly switched over. However, TiDB’s underlying architecture is completely different from MySQL, so to use TiDB efficiently, you still need to study TiDB’s architecture principles.
  4. In the connection information window, on the General tab, give the connection a name for easy identification.
    Hostname or IP address: the HOST domain name from the connection information above.
    Port: the PORT shown in the connection information above is 4000.
    Username: the USERNAME from the connection information above.
    Password: the PASSWORD from the connection information above, which is the password created earlier.
    After completing the above operations, click the SSL tab.
    Use SSL, check it.
    Use verification, check it.
    In the CA certificate field, fill in the path of the downloaded CA certificate, as shown in the figure below.
    Verify CA certificate name, check it.
    Then, click “Test Connection.”
    A connection success window will pop up, indicating that you have successfully connected to the TiDB database of the newly created Cluster1 cluster.
    Then click “OK.”
    Click “OK” again.
    Return to the main page, and you can see that the Cluster1 connection name you just created has appeared.
    Double-click Cluster1, and it will light up. Then double-click the test database to see various objects inside.
    On the Navicat main page, click “New Query.”
    Select the Cluster1 connection name and choose any database; here, I choose the test database.
    Enter the following statements and execute them one by one to see the results below.
    Note: In Navicat, use the up arrow key to move the cursor, the home key to move the cursor to the beginning of the line, and the end key to move the cursor to the end of the line.
    Assuming the cursor is at the beginning of the line, shift+end can select the current line; similarly, when the cursor is at the end of the line, shift+home can also select the current line.
    Ctrl+r: execute the selected SQL. If no SQL is selected, it will execute all SQL statements on the current page by default.
    Change password: user password.
    After changing the password, right-click the Cluster1 connection on the left side of Navicat and select “Edit Connection.”
    On the General tab, change the password to the one you just changed, then click “Test Connection” and find that the connection test is successful.
    Then click “OK.”

    Click “OK” again, and it shows that the connection is already in use and cannot be saved and exited. This may be due to the Navicat version.
    So I clicked “Cancel” to exit the edit Cluster1 connection page. See the solution below.

    Create a new connection named cluster1-1.
    Except for the connection name and password, all other parameters are exactly the same as when the connection was first established.
    Use the modified password to connect.
    Remember that SSL also needs to be configured the same way.
| username: 呢莫不爱吃鱼 | Original post link

Mark this for future use.

| username: DBAER | Original post link

Is this study note for redeeming points?

| username: TiDBer_小阿飞 | Original post link

There is a problem. Since it is an overseas server, the first issue for commercial use is security, and the second is speed.

| username: TiDBer_21wZg5fm | Original post link

This is very informative.

| username: TIDB-Learner | Original post link

:rofl: It is of reference value.