📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

Connect to TiDB with DBeaver



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 TiDB using DBeaver Community.

Prerequisites

To complete this tutorial, you need:

If you don't have a TiDB cluster, you can create one as follows:

In addition, to connect to a TiDB Cloud Starter or TiDB Cloud Essential public endpoint from DBeaver on Windows, you must configure an additional SSL certificate (ISRG Root X1) as follows. Otherwise, the connection will fail. For other operating systems, you can skip these steps.

  1. Download the ISRG Root X1 certificate and save it to a local path, such as C:\certs\isrgrootx1.pem.

  2. In DBeaver, edit your connection and go to the SSL tab:

    1. Select Use SSL.
    2. In the CA certificate field, select the isrgrootx1.pem file you downloaded.
    3. Leave the other certificate fields empty.
  3. On the Driver properties tab, remove any existing sslMode, useSSL, or requireSSL entries to avoid SSL configuration conflicts.

  4. Click Test Connection to verify that the connection is successful.

Connect to TiDB

Connect to TiDB depending on the TiDB deployment option you've selected.

    1. Navigate to the My TiDB page, and then click the name of your target TiDB Cloud Starter or Essential instance to go to its overview page.

    2. Click Connect in the upper-right corner. A connection dialog is displayed.

    3. 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.
    4. Click Generate Password to create a random password.

    5. 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.

      Select TiDB as the database in DBeaver

    6. 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.

    7. In the Authentication (Database Native) section, enter your Username and Password. An example is as follows:

      Configure connection settings for TiDB Cloud Starter

    8. Click Test Connection to validate the connection to your target TiDB Cloud Starter or Essential instance.

      If the Download driver files dialog is displayed, click Download to get the driver files.

      Download driver files

      If the connection test is successful, the Connection test dialog is displayed as follows. Click OK to close it.

      Connection test result

    9. Click Finish to save the connection configuration.

    1. Navigate to the My TiDB page, and then click the name of your target TiDB Cloud Premium instance to go to its overview page.

    2. In the left navigation pane, click Settings > Networking.

    3. On the Networking page, click Enable for Public Endpoint, and then click Add IP Address.

      Ensure that your client IP address is added to the access list.

    4. In the left navigation pane, click Overview to return to the instance overview page.

    5. Click Connect in the upper-right corner. A connection dialog is displayed.

    6. In the connection dialog, select Public from the Connection Type drop-down list.

      • If a message indicates that the public endpoint is still being enabled, wait until the process completes.
      • If you have not set a password yet, click Set Root Password in the dialog.
      • If you need to verify the server certificate or if the connection fails and requires a CA certificate, click CA cert to download it.
      • In addition to the Public connection type, TiDB Cloud Premium supports Private Endpoint connections. For more information, see Connect to TiDB Cloud Premium via AWS PrivateLink.
    7. 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.

    8. Copy and paste the appropriate connection string into the DBeaver connection panel. The mappings between DBeaver fields and TiDB Cloud Premium connection string are as follows:

      DBeaver fieldTiDB Cloud Premium connection string
      Server Host{host}
      Port{port}
      Username{user}
      Password{password}

      Keep the SSL settings disabled.

    9. Click Test Connection to validate the connection to the TiDB Cloud Premium instance.

    10. Click Finish to save the connection configuration.

    1. Navigate to the My TiDB page, and then click the name of your target TiDB Cloud Dedicated cluster to go to its overview page.

    2. Click Connect in the upper-right corner. A connection dialog is displayed.

    3. 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 Cloud Dedicated supports Private Endpoint and VPC Peering connection types. For more information, see Connect to Your TiDB Cloud Dedicated Cluster.

    4. 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.

      Select TiDB as the database in DBeaver

    5. 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 fieldTiDB Cloud Dedicated connection string
      Server Host{host}
      Port{port}
      Username{user}
      Password{password}

      An example is as follows:

      Configure connection settings for TiDB Cloud Dedicated

    6. 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.

      Download driver files

      If the connection test is successful, the Connection test dialog is displayed as follows. Click OK to close it.

      Connection test result

    7. Click Finish to save the connection configuration.

    1. 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.

      Select TiDB as the database in DBeaver

    2. 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:

      Configure connection settings for TiDB Self-Managed

    3. 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.

      Download driver files

      If the connection test is successful, the Connection test dialog is displayed as follows. Click OK to close it.

      Connection test result

    4. Click Finish to save the connection configuration.

    Next steps

    Need help?

    Was this page helpful?