How to Connect TiDB Cloud to Metabase

Author: Phoebe He (Content Developer at PingCAP)

Editors: Calvin Weng, Caitin Chen

TiDB Cloud is a fully-managed Database-as-a-Service (DBaaS) that brings everything great about TiDB to your cloud and lets you focus on your applications, not the complexities of your database.

In this 15-minute tutorial, you will learn how to connect TiDB Cloud to Metabase, an open-source business intelligence (BI) tool. We will be using Metabase to build a BI dashboard and gain analytical insights using sample data from Capital Bikeshare (data released under the Capital Bikeshare Data License Agreement).

Before you begin

  • Create a TiDB Cloud cluster and import the Capital Bikeshare sample data following the TiDB Cloud Quick Start Guide.
  • Install Metabase by following these instructions. You’ll have the option of installing it on-premise or in the cloud.

Get TiDB Cluster IP address

1. Go to and sign in to your cluster.

2. On the TiDB Cloud console, click Connect on the upper right of the pane.
The Connect to TiDB dialog displays.

3. Create the traffic filter for the cluster.

  • Depending on how you use Metabase, select a traffic filter from the following options:
    ▹If you are using an on-prem version of Metabase, click Add Your Current IP Address. Your IP Address will be automatically populated.
    ▹If you are using Metabase on a cloud platform, click Allow Access from Anywhere.
  • Click Create Filter.

4. Take note of the TiDB Cloud IP address, listed between the -h parameter and -P parameter, as you will use it at a later step. For example: mysql -u root -h -P 4000 -p

Connect TiDB Cloud to Metabase

1. Start the Metabase application and click Let’s get started.

2. Select your preferred language in step 1 and click Next.

3. Enter your information and account details in step 2 and click Next.

4. In the Add your data step, click the Database type drop-down menu and select MySQL.

5. Specify the following settings

  • Name: Bikeshare
  • Host: <your_tidb_cloud_ip_address_obtained_in_the_previous_step>
  • Port: 4000

6. Database name: bikeshare

  • Username: root
  • Password: <password_of_your_tidb_cluster>
    Here is an example:

7. Scroll down to the bottom and click Next.

8. For the Usage data preference step, change your preference if needed and click Next.

9. Click Take me to Metabase.

Build BI Dashboard

In this exercise, we will be analyzing the sample data from Capital Bikeshare to identify the most popular type of bicycle.

1. On the homepage of Metabase, scroll down to the OUR DATA section and click Bikeshare.

2. Click the Trips table.

3. Explore the trips table. This is the sample data set you imported to the TiDB Cloud cluster.

4. To display how many records are associated with each rideable bike type, click the +Summarize button on the top right.

5. Select Count as the metric and select Rideable Type for the Group by field.

The bar chart displays immediately.

We can see that docked bikes are the most popular bike type and electric bikes are the least popular kind of bike.

Want to learn more?

Ready to give TiDB Cloud a try? TiDB Cloud Developer Tier is now available! It lets you run a TiDB cluster for free for one year on Amazon Web Services. Make sure to follow us on Twitter to stay updated on TiDB Cloud news!

Originally published at on November 24, 2021.




PingCAP is the team behind TiDB, an open-source MySQL compatible NewSQL database. Official website: GitHub:

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

(PrismJS || HighlightJS || CodeMirror 6) + CodeDetectionAPI = ❤️

Improve Performance and Reduce Memory Usage Of Your Application

Solution for the : Error while installing Prophet library on Windows Machine

These new features are launching on WhatsApp soon, and they will change the way you chat on the…

A message for those who just started coding

Things you should know about JAVA Threads, Before going to an Interview

Visualize Your Kong API Gateway Clusters With KongMap

How to Embed Hype Animations and HTML5 widgets in PubCoder

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


PingCAP is the team behind TiDB, an open-source MySQL compatible NewSQL database. Official website: GitHub:

More from Medium

How TiDB Powers Real-Time Analytics for a Streaming Media Giant

First Anniversary Celebration of Apache DolphinScheduler’s Graduation From ASF Incubator!

Case Study: SaaS Company Powers Customer-Facing Dashboards with Rockset and Postgres