how-to-connect-tidb-cloud-to-metabase

Overview

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 https://tidbcloud.com/console/clusters 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 Metabase on a cloud platform, click Allow Access from Anywhere.
    • Click Create Filter.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 tidb.xxx.xxxxx.us-west-2.prod.aws.tidbcloud.com -P 4000 -p

Connect TiDB Cloud to Metabase

  1. Start the Metabase application and click Let’s get started.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:Database name
  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.Scroll down to OUR DATA
  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.Click +Summarize
  5. Select Count as the metric and select Rideable Type for the Group by field.Select CountThe bar chart displays immediately.Bar chart displaysWe 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!


Book a Demo


Spin up a Serverless database with 25GiB free resources.

Start Right Away

Have questions? Let us know how we can help.

Contact Us

TiDB Cloud Dedicated

A fully-managed cloud DBaaS for predictable workloads

TiDB Cloud Serverless

A fully-managed cloud DBaaS for auto-scaling workloads