- Introduction
- Quick Start
- Perform a PoC
- Use Your Cluster
- Create a TiDB Cluster
- Connect to Your TiDB Cluster
- Set Up VPC Peering Connections
- Monitor a TiDB Cluster
- Overview
- Built-in Alerting
- Third-Party Monitoring Integrations
- Scale a TiDB Cluster
- Use an HTAP Cluster
- Back Up and Restore Data
- Tune Performance
- Upgrade a TiDB Cluster
- Delete a TiDB Cluster
- Migrate Data
- Import Sample Data
- Migrate Data into TiDB
- Export Data from TiDB
- Manage User Access
- Billing
- Reference
- Support
- FAQs
- Glossary
- Release Notes
Connect to Your TiDB Cluster
After your TiDB cluster is created on TiDB Cloud, you can use one of the following three methods to connect to your TiDB cluster. You can access your cluster via a SQL client, or quickly via SQL Shell in the TiDB Cloud Console.
Connect via a SQL client
- Connect via standard connection: The standard connection exposes a public endpoint with traffic filters, so you can connect to your TiDB cluster from your laptop.
- Connect via VPC peering: If you want lower latency and more security, set up VPC peering and connect via a private endpoint using a VM instance on the corresponding cloud provider in your cloud account. Note that you cannot connect to Developer Tier clusters using VPC peering.
- Connect via SQL shell: to try TiDB SQL and test out TiDB's compatibility with MySQL quickly, or administer user privileges
Connect via standard connection
To connect to your TiDB cluster via standard connection, perform the following steps:
Navigate to the TiDB Cluster page and click the name of your newly created cluster.
Click Connect. The Connect to TiDB dialog displays.
Create the traffic filter for the cluster. Traffic filter is a list of IPs and CIDR addresses that are allowed to access TiDB Cloud via SQL client.
If it is the first time that you connect to the cluster, the traffic filter is empty by default. Perform the following sub-steps to add one. If the traffic filter is already set, skip this step.
Click one of the buttons to add some rules quickly.
- Add Your Current IP Address
- Add Rules from Default Set
- Allow Access from Anywhere
Provide an optional description for the newly added IP address or CIDR range.
Click Create Filter to confirm the changes.
Use a SQL client to connect to TiDB.
mysql -u root -h <endpoint> -P <port number> -p
Connect via VPC peering
This method does not work for Developer Tier clusters because you cannot connect to Developer Tier clusters using VPC peering.
To connect to your TiDB cluster via VPC peering, perform the following steps:
Navigate to the TiDB Cluster page and click the name of your newly created cluster.
Click Connect, and select the VPC Peering tab at the Connect to TiDB dialog.
Set up VPC peering. See Set up VPC Peering for details.
Click Get Endpoint and wait for a few minutes. Then the connection command displays in the dialog.
Use a SQL client to connect to TiDB from your server which has set up VPC peering with TiDB Cloud.
mysql -u root -h <endpoint> -P <port number> -p
Connect via SQL Shell
To connect to your TiDB cluster using SQL shell, perform the following steps:
Navigate to the TiDB Cluster page and click the name of your newly created cluster.
Click Connect, and select the Web SQL Shell tab at the Connect to TiDB dialog.
Click Open SQL Shell.
On the prompted TiDB password line, enter the root password of the current cluster. Then your application is connected to the TiDB cluster.
What's next
After you have successfully connected to your TiDB cluster, you can explore SQL statements with TiDB.