All Products
Search
Document Center

ApsaraDB for SelectDB:Grafana data visualization

Last Updated:Mar 30, 2026

ApsaraDB for SelectDB is compatible with MySQL 5.7 connection protocols, so you can connect it to Managed Service for Grafana as a MySQL data source. This topic walks you through adding a SelectDB instance as a data source and building dashboards with table panels and time series charts.

Prerequisites

Before you begin, ensure that you have:

  • Public endpoint: A public endpoint for your SelectDB instance. See Apply for or release a public endpoint.

  • Credentials: The username and password for your SelectDB instance. Use a read-only account with minimal permissions to reduce security risk.

  • Workspace: A Grafana workspace created in Managed Service for Grafana. See Create and manage a Grafana workspace.

  • IP whitelist: The public IP address of your Grafana workspace added to the IP address whitelist of your SelectDB instance. To get the workspace's public IP address: Then add that IP address to the SelectDB whitelist. See Configure an IP address whitelist.

    1. Log on to the ARMS console. In the left-side navigation pane, choose Managed Service for Grafana > Workspace Management.

    2. Click the ID or name of your workspace. In the Public IP Address section, note the IP address.

Billing

Managed Service for Grafana Shared Edition generates no fees. See Billing rules for details.

Step 1: Add SelectDB as a data source

Managed Service for Grafana does not have a native SelectDB data source type. Because SelectDB is compatible with MySQL 5.7 connection protocols and syntax, use the MySQL data source type.
  1. Log on to the ARMS console. In the left-side navigation pane, choose Managed Service for Grafana > Workspace Management.

  2. On the Workspace Management page, click the URL in the URL column for your workspace to open Grafana.

    Log on with the Grafana administrator account and the password you set when creating the workspace, or click Sign in with Alibaba Cloud to use your current Alibaba Cloud account.
  3. Grafana 9.x

    In the left-side navigation pane, click the image icon. Click Add data source, then click MySQL.

    Grafana 10.x

    1. Click the image icon in the upper-left corner.

    2. In the left-side navigation pane, choose Management > Data sources.

    3. On the Data sources tab, click Add data source, then click MySQL.

  4. On the Settings page, configure the following parameters. For additional parameters, see the Grafana MySQL data source documentation.

    Parameter Description
    Name A name for this data source
    Host The public endpoint of your SelectDB instance, in the format <Public endpoint>:<MySQL port>. For example: selectdb-cn-bcd****-public.selectdbfe.rds.aliyuncs.com:9030. Find the endpoint on the details page of your SelectDB instance.
    Database The name of your SelectDB instance
    User The username for your SelectDB instance. Use a read-only account with minimal permissions.
    Password The password for your SelectDB instance
  5. Click Save & Test. If Database Connection OK appears, the data source is connected. If an error appears, see Troubleshooting.

Step 2: Build a dashboard

The following example uses a test_table with columns id, place, user, operate, operate_time, and count. The sample data:

SELECT * FROM `test_table` WHERE operate_time < '2022-07-20 03:00:00';
ID place user operate operate_time count
1 China (Hangzhou) User A Browse 2022/7/20 0:00 3
2 China (Hangzhou) User A Browse 2022/7/20 1:00 8
3 China (Hangzhou) User A Browse 2022/7/20 2:00 13
11 China (Beijing) User A Browse 2022/7/20 0:00 23
12 China (Beijing) User B Browse 2022/7/20 1:00 18
13 China (Beijing) User B Browse 2022/7/20 2:00 3
21 China (Beijing) User C Browse 2022/7/20 0:00 13
22 China (Beijing) User C Browse 2022/7/20 1:00 22
23 China (Beijing) User C Browse 2022/7/20 2:00 23

Create a table panel

  1. In the left-side navigation pane, click the 34 icon, then click New dashboard.

  2. Click Add a new panel.

  3. On the Visualizations tab on the right side of the Edit Panel page, select Table.

  4. On the Query tab, select the data source you added in Step 1.

  5. In section A, enter the following query and set Format as to Format as Table:

    SELECT
      id AS "Serial number",
      place AS "City",
      user AS "User",
      operation AS "Operation",
      count AS "Number of occurrences",
      operate_time AS "Operation time"
    FROM test_table
  6. Click Apply in the upper-right corner.

Create a time series chart

  1. In the upper-right corner of the dashboard, click the Add panel icon, then click Add a new panel.

  2. On the Visualizations tab of the Edit Panel page, select Time series.

  3. On the Query tab, select the data source you added in Step 1.

  4. In the A panel, configure the query settings:

    Setting Value
    Time column operate_time
    Metric column user
    SELECT count
    Format as Time Series

    Time series chart example

  5. (Optional) To display the data as a column chart, go to the Graph styles section in the right-side panel and set Style to Bars.

    Column chart example

  6. Click Apply in the upper-right corner.

Troubleshooting

If the connection test fails after clicking Save & Test, check the following:

  • Incorrect connection details: Verify that the Host, Database, User, and Password values match your SelectDB instance configuration. The host must follow the format <Public endpoint>:<MySQL port> (for example, port 9030).

  • IP address not whitelisted: Confirm that the public IP address of your Grafana workspace is added to the IP address whitelist of your SelectDB instance. See Configure an IP address whitelist. Find the workspace's public IP address in the Public IP Address section of the workspace details page.

What's next