Sign InTry Free

TiDB Cloud Quick Start

Estimated completion time: 20 minutes

This tutorial guides you through an easy way to get started with your TiDB Cloud. The content includes how to create a cluster, connect to a cluster, import data, and run queries.

Step 1. Create a TiDB cluster

You can either create a free Developer Tier cluster or a Dedicated Tier.

  • Developer Tier
  • Dedicated Tier

To create a free Developer Tier cluster, take the following steps:

  1. If you do not have a TiDB Cloud account, click here to sign up for an account.

    • For Google users, you can also sign up with Google. To do that, click Sign up with Google on the sign up page. Your email address and password will be managed by Google and cannot be changed using TiDB Cloud console.
    • For GitHub users, you can also sign up with GitHub. To do that, click Sign up with GitHub on the sign up page. Your email address and password will be managed by GitHub and cannot be changed using TiDB Cloud console.
  2. Log in to your TiDB Cloud account.

    The plan selection page is displayed by default.

  3. On the plan selection page, click Get Started for Free in the Developer Tier plan.

  4. On the Create Cluster page, Developer Tier is selected by default. Update the default cluster name if necessary, and then select the region where you want to create your cluster.

  5. Click Create.

    The cluster creation process starts and your TiDB Cloud cluster will be created in approximately 5 to 15 minutes.

  6. During the creation process, perform security settings for your cluster:

    1. Click Security Settings in the upper-right corner of the cluster area.
    2. In the Security Settings dialog box, set the root password and allowed IP addresses to connect to your cluster, and then click Apply.

To create a Dedicated Tier cluster, take the following steps:

  1. If you do not have a TiDB Cloud account, click here to sign up for an account.

    • For Google users, you can also sign up with Google. To do that, click Sign up with Google on the sign up page. Your email address and password will be managed by Google and cannot be changed using TiDB Cloud console.
    • For GitHub users, you can also sign up with GitHub. To do that, click Sign up with GitHub on the sign up page. Your email address and password will be managed by GitHub and cannot be changed using TiDB Cloud console.
    • For AWS Marketplace users, you can also sign up through AWS Marketplace. To do that, search for TiDB Cloud in AWS Marketplace, subscribe to TiDB Cloud, and then follow the onscreen instructions to set up your TiDB Cloud account.
  2. Log in to your TiDB Cloud account.

    The plan selection page is displayed by default.

  3. On the plan selection page, click Get Full Access Today in the Dedicated Tier plan.

  4. On the Create a Cluster page, Dedicated Tier is selected by default. Update the default cluster name and port number if necessary, choose a cloud provider and a region, and then click Next.

  5. If this is the first cluster of your current project and CIDR has not been configured for this project, you need to set the project CIDR, and then click Next. If you do not see the project CIDR field, it means that CIDR has already been configured for this project.

  6. Configure the cluster size for TiDB, TiKV, and TiFlash (optional) respectively, and then click Next.

  7. Confirm the cluster information on the page and also the billing information in the lower-left corner.

  8. Click Add Credit Card in the lower-right corner to add a credit card for your account.

  9. Click Create.

    The cluster creation process starts and the Security Settings dialog box is displayed.

  10. In the Security Settings dialog box, set the root password and allowed IP addresses to connect to your cluster, and then click Apply.

    Your TiDB Cloud cluster will be created in approximately 5 to 15 minutes.

Step 2. Connect to your TiDB cluster

  1. Navigate to the Clusters page.

  2. In the area of your newly created cluster, click Connect in the upper-right corner. A connection dialog is displayed.

  3. Follow the instructions in the dialog to connect to your TiDB cluster.

    • Developer Tier
    • Dedicated Tier

    To connect to a Developer Tier cluster, check Step 2: Connect with a SQL client in the dialog, click the tab of your preferred connection method, and then connect to your cluster with the connection string.

    To connect to a Dedicated Tier cluster, take the following steps:

    1. Under Step 1: Create traffic filter in the dialog, specify the allowed IP addresses to connect to your cluster. If you have already configured the IP addresses in Security Settings, skip this step.

    2. Under Step 2: Download TiDB cluster CA in the dialog, click Download TiDB cluster CA for TLS connection to TiDB clusters. The TiDB cluster CA supports TLS 1.2 version by default.

    3. Under Step 3: Connect with a SQL client in the dialog, click the tab of your preferred connection method, and then refer to the connection string and sample code on the tab to connect to your cluster.

  4. After logging into your TiDB cluster, you can use the following SQL statement to validate the connection:

    SELECT TiDB_version();
    

    If you see the release version information, you are ready to use your TiDB cluster.

Step 3. Import the sample data

We provide Capital Bikeshare sample data for you to easily import data and run sample queries.

  1. Navigate to the Clusters page.

  2. In the area of your newly created cluster, click ... in the upper-right corner and select Import Data. The Data Import page is displayed.

  3. Fill in the import parameters:

    • AWS
    • GCP

    If your TiDB cluster is hosted by AWS (the Developer Tier is hosted by AWS by default), fill in the following parameters:

    • Data Format: select TiDB Dumpling
    • Location: AWS
    • Bucket URL: enter the sample data URL s3://tidbcloud-samples/data-ingestion/
    • Role-ARN: enter arn:aws:iam::385595570414:role/import-sample-access
    • Target Cluster: shows the cluster name and the region name.

    If the region of the bucket is different from your cluster, confirm the compliance of cross region. Click Next.

    If your TiDB cluster is hosted by GCP, fill in the following parameters:

    • Data Format: select TiDB Dumpling.
    • Location: Google Cloud
    • Bucket URL: enter the sample data URL gs://tidbcloud-samples-us-west1.
    • Target Cluster: shows the cluster name and the region name.

    If the region of the bucket is different from your cluster, confirm the compliance of cross region. Click Next to validate the data access and go to the next page.

  4. Add the table filter rules if needed. For the sample data, you can skip this step. Click Next.

  5. On the Preview page, confirm the data to be imported and then click Start Import.

The data import process will take 5 to 10 minutes. When the data import progress shows Finished, you have successfully imported the sample data and the database schema to your database in TiDB Cloud.

Step 4. Query data

When the process of importing data is completed, you can start to run some queries in your Terminal:

  1. Use the bikeshare database and tables:

    USE bikeshare;
    SHOW tables;
    
  2. Check the structure of the trip table:

    DESCRIBE trips;
    
  3. Check how many records exist in the trips table:

    SELECT COUNT(*) FROM trips;
    
  4. Check the entire trip history where the start station is "8th & D St NW":

    SELECT * FROM trips WHERE start_station_name = '8th & D St NW';
    
  5. Show the least ten popular bicycle stations for picking up:

    SELECT start_station_name, COUNT(ride_id) as count from `trips`
    GROUP BY start_station_name
    ORDER BY count ASC
    LIMIT 10;
    
Download PDFRequest docs changes
Was this page helpful?
Open Source Ecosystem
TiDB
TiKV
TiSpark
Chaos Mesh
© 2022 PingCAP. All Rights Reserved.