Connect Grafana to AnalyticDB for MySQL

Updated at:
Copy as MD

This topic describes how to connect Grafana to AnalyticDB for MySQL to visualize and analyze data.

Prerequisites

  • You have installed Grafana.

  • You have added the IP address of the Grafana server to the whitelist of your AnalyticDB for MySQL cluster.

Procedure

  1. Go to your Grafana home page. In the left navigation pane, click Connections > Add new connection, and then select MySQL.

  2. On the MySQL data source page, click Add new data source.

  3. Configure the following parameters:

    Parameter

    Description

    Name

    A custom name for the data source.

    Host URL

    The endpoint of your AnalyticDB for MySQL cluster.

    • If Grafana is installed on an ECS instance in the same VPC as your AnalyticDB for MySQL cluster, enter the ECS endpoint.

    • If Grafana is installed on an on-premises server, enter the public endpoint.

    Database name

    The AnalyticDB for MySQL to use for the connection.

    Username

    The username for the AnalyticDB for MySQL.

    Password

    The password for the AnalyticDB for MySQL.

    Other parameters

    For more information, see the official Grafana documentation.

  4. Click Save & Test. The Database Connection OK message indicates a successful connection.

  5. Analyze your data.

    Once configured, you can use the data source to visualize and analyze data. For more information, see the official Grafana documentation.

    For example, create a new dashboard panel in Grafana. Select mysql-1 as the data source. Set Format to Table. Select adb_demo for Dataset and test for Table. For Column, select name and age. The query results are displayed in a table.