title | summary |
---|---|
Connect to TiDB with DBeaver |
Learn how to connect to TiDB using DBeaver Community. |
TiDB is a MySQL-compatible database, and DBeaver Community is a free cross-platform database tool for developers, database administrators, analysts, and everyone working with data.
In this tutorial, you can learn how to connect to your TiDB cluster using DBeaver Community.
Note:
This tutorial is compatible with TiDB Cloud Serverless, TiDB Cloud Dedicated, and TiDB Self-Managed.
To complete this tutorial, you need:
- DBeaver Community 23.0.3 or higher.
- A TiDB cluster.
If you don't have a TiDB cluster, you can create one as follows:
- (Recommended) Follow Creating a TiDB Cloud Serverless cluster to create your own TiDB Cloud cluster.
- Follow Deploy a local test TiDB cluster or Deploy a production TiDB cluster to create a local cluster.
If you don't have a TiDB cluster, you can create one as follows:
- (Recommended) Follow Creating a TiDB Cloud Serverless cluster to create your own TiDB Cloud cluster.
- Follow Deploy a local test TiDB cluster or Deploy a production TiDB cluster to create a local cluster.
Connect to your TiDB cluster depending on the TiDB deployment option you've selected.
-
Navigate to the Clusters page, and then click the name of your target cluster to go to its overview page.
-
Click Connect in the upper-right corner. A connection dialog is displayed.
-
Ensure the configurations in the connection dialog match your operating environment.
- Connection Type is set to
Public
- Branch is set to
main
- Connect With is set to
DBeaver
- Operating System matches your environment.
- Connection Type is set to
-
Click Generate Password to create a random password.
Tip:
If you have created a password before, you can either use the original password or click Reset Password to generate a new one.
-
Launch DBeaver and click New Database Connection in the upper-left corner. In the Connect to a database dialog, select TiDB from the list, and then click Next.
-
Copy the connection string from the TiDB Cloud connection dialog. In DBeaver, select URL for Connect by and paste the connection string into the URL field.
-
In the Authentication (Database Native) section, enter your Username and Password. An example is as follows:
-
Click Test Connection to validate the connection to the TiDB Cloud Serverless cluster.
If the Download driver files dialog is displayed, click Download to get the driver files.
If the connection test is successful, the Connection test dialog is displayed as follows. Click OK to close it.
-
Click Finish to save the connection configuration.
-
Navigate to the Clusters page, and then click the name of your target cluster to go to its overview page.
-
Click Connect in the upper-right corner. A connection dialog is displayed.
-
In the connection dialog, select Public from the Connection Type drop-down list, and then click CA cert to download the CA certificate.
If you have not configured the IP access list, click Configure IP Access List or follow the steps in Configure an IP Access List to configure it before your first connection.
In addition to the Public connection type, TiDB Dedicated supports Private Endpoint and VPC Peering connection types. For more information, see Connect to Your TiDB Dedicated Cluster.
-
Launch DBeaver and click New Database Connection in the upper-left corner. In the Connect to a database dialog, select TiDB from the list, and then click Next.
-
Copy and paste the appropriate connection string into the DBeaver connection panel. The mappings between DBeaver fields and TiDB Cloud Dedicated connection string are as follows:
DBeaver field TiDB Cloud Dedicated connection string Server Host {host}
Port {port}
Username {user}
Password {password}
An example is as follows:
-
Click Test Connection to validate the connection to the TiDB Cloud Dedicated cluster.
If the Download driver files dialog is displayed, click Download to get the driver files.
If the connection test is successful, the Connection test dialog is displayed as follows. Click OK to close it.
-
Click Finish to save the connection configuration.
-
Launch DBeaver and click New Database Connection in the upper-left corner. In the Connect to a database dialog, select TiDB from the list, and then click Next.
-
Configure the following connection parameters:
- Server Host: The IP address or domain name of your TiDB Self-Managed cluster.
- Port: The port number of your TiDB Self-Managed cluster.
- Username: The username to use to connect to your TiDB Self-Managed cluster.
- Password: The password of the username.
An example is as follows:
-
Click Test Connection to validate the connection to the TiDB Self-Managed cluster.
If the Download driver files dialog is displayed, click Download to get the driver files.
If the connection test is successful, the Connection test dialog is displayed as follows. Click OK to close it.
-
Click Finish to save the connection configuration.
- Learn more usage of DBeaver from the documentation of DBeaver.
- Learn the best practices for TiDB application development with the chapters in the Developer guide, such as Insert data, Update data, Delete data, Single table reading, Transactions, and SQL performance optimization.
- Learn through the professional TiDB developer courses and earn TiDB certifications after passing the exam.
Ask questions on TiDB Community, or create a support ticket.
Ask questions on TiDB Community, or create a support ticket.