Grafana Cloud

MySQL integration for Grafana Cloud

MySQL is a managed, open source relational database management system. The MySQL integration enables you to automatically scrape and send metrics and logs from MySQL databases to Grafana Cloud. This integration includes useful prebuilt dashboards, alerts, and recording rules to help you monitor relevant metrics and logs.

Before you begin

This integration enables Grafana Agent to send MySQL metrics and logs to Grafana Cloud.

Supported versions:

  • MySQL >= 5.6.
  • MariaDB >= 10.2

Install MySQL integration for Grafana Cloud

  1. In your Grafana instance, click Integrations and Connections (lightning bolt icon), then click on the MySQL tile to install the integration.
  2. Once the integration is installed, follow the steps on the Configuration Details page to configure the Grafana agent to automatically scrape and send MySQL metrics and logs to your Grafana cloud instance.

Post-install configuration for the MySQL integration

This integration supports metrics and logs from MySQL. In order to see those signals correlated on the same dashboard, job and instance labels must match for mysql_integration(metrics) and logs in the agent configuration file:

  wal_directory: /tmp/wal
    - name: agent
        - url: http://loki:3100/loki/api/v1/push
        filename: /tmp/positions.yaml
        sync_period: 10s
        - job_name: integrations/mysql
            - labels:
                instance: mysql-01
                job: integrations/mysql
                __path__: /var/log/mysql/*.log
            - regex:
                expression: '(?P<timestamp>.+) (?P<thread>[\d]+) \[(?P<label>.+?)\]( \[(?P<err_code>.+?)\] \[(?P<subsystem>.+?)\])? (?P<msg>.+)'
            - labels:
            - drop:
                expression: '^ *$'
                drop_counter_reason: 'drop empty lines'

    - url: http://cortex:9009/api/prom/push
    enabled: true
    instance: mysql-01
    data_source_name: 'root:put-password-here@(localhost:3306)/'
      - source_labels: [__address__]
        target_label: job
        replacement: 'integrations/mysql'

It’s recommended to configure a separate user for the agent to give it only the strictly mandatory security privileges necessary for monitoring your node. For more information, see the MySQL Server Exporter documentation.

Tip: If you set the MYSQL_ALLOW_EMPTY_PASSWORD flag then you can omit the password in the data_source_name parameter.

For other data_source_name options, refer to the MySQL section of the go-sql-driver README.


After you have successfully configured the MySQL integration, two prebuilt dashboards will be installed in your Grafana instance to help you monitor your MySQL metrics and logs.

MySQL overview dashboard

This dashboard gives a general overview of all relevant metrics from your MySQL instance, such as uptime, connections, thread cache, and more.

MySQL overview dashboard example

MySQL logs dashboard

This dashboard contains statistics of the logs collected by Grafana Agent through MySQL. It contains panels that surface errors, warnings, and complete log files in separate views.

MySQL logs dashboard example


Grafana Cloud alerts are directly tied to metrics and log data. This integration includes the following useful alerts:

  • MySQL is down : Continuously checks the availability of MySQL service

  • Galera Alerts : Monitors the health of Galera cluster

Metrics captured by MySQL integration for Grafana Cloud

For a complete list of all metrics provided by MySQL integration, refer MySQL Prometheus metrics.

The most important metrics provided are as follows:

  • MySQL uptime
  • Queries per second
  • InnoDB Buffer Pool
  • Max connections
  • Max used connections
  • Avg threads running
  • Peak threads running
  • MySQL questions
  • Thread cache size
  • Threads cached
  • Threads created
  • Tmp tables created
  • Tmp files created
  • Tmp disk tables created
  • MySQL sorts
  • MySQL slow queries
  • MySQL aborted connections
  • MySQL table locks waited
  • MySQL table locks immediate
  • MySQL network outbound traffic
  • MySQL network inboud traffic
  • MySQL key buffer size
  • MySQL InnoDB log buffer size
  • MySQL InnoDB buffer pool data
  • MySQL InnoDB dictionary size
  • MySQL InnoDB open files
  • MySQL query cached size
  • MySQL top commands executed
  • MySQL query cache memory size
  • MySQL query cache free memory
  • MySQL queries in cache
  • MySQL cache prunes
  • MySQL file openings
  • MySQL open files limit
  • MySQL open files
  • MySQL table open cache misses due to overflows
  • MySQL table open cache misses
  • MySQL table open cache hits
  • MySQL table open cache openings
  • MySQL table open cache hit ratio
  • MySQL table definitions cache size
  • MySQL open table definitions


By connecting your MySQL integration to Grafana Cloud you might incur charges. For more information, use the following links: