Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source


The mysqld_exporter_config block configures the mysqld_exporter integration, which is an embedded version of mysqld_exporter and allows for collection metrics from MySQL servers.

Note that currently, an Agent can only collect metrics from a single MySQL server. If you want to collect metrics from multiple servers, run multiple Agents and add labels using relabel_configs to differentiate between the MySQL servers:

  enabled: true
  data_source_name: root@(server-a:3306)/
  - source_labels: [__address__]
    target_label: instance
    replacement: server-a

We strongly recommend that you configure a separate user for the Agent, and give it only the strictly mandatory security privileges necessary for monitoring your node, as per the official documentation.

Full reference of options:

  # Enables the mysqld_exporter integration, allowing the Agent to collect
  # metrics from a MySQL server.
  [enabled: <boolean> | default = false]

  # Sets an explicit value for the instance label when the integration is
  # self-scraped. Overrides inferred values.
  # The default value for this integration is a truncated version of the
  # connection DSN, containing only the server and db name. (Credentials
  # are not included.)
  [instance: <string>]

  # Automatically collect metrics from this integration. If disabled,
  # the mysqld_exporter integration will be run but not scraped and thus not
  # remote-written. Metrics for the integration will be exposed at
  # /integrations/mysqld_exporter/metrics and can be scraped by an external
  # process.
  [scrape_integration: <boolean> | default = <integrations_config.scrape_integrations>]

  # How often should the metrics be collected? Defaults to
  [scrape_interval: <duration> | default = <global_config.scrape_interval>]

  # The timeout before considering the scrape a failure. Defaults to
  [scrape_timeout: <duration> | default = <global_config.scrape_timeout>]

  # Allows for relabeling labels on the target.
    [- <relabel_config> ... ]

  # Relabel metrics coming from the integration, allowing to drop series
  # from the integration that you don't care about.
    [ - <relabel_config> ... ]

  # How frequent to truncate the WAL for this integration.
  [wal_truncate_frequency: <duration> | default = "60m"]

  # Data Source Name specifies the MySQL server to connect to. This is REQUIRED
  # but may also be specified by the MYSQLD_EXPORTER_DATA_SOURCE_NAME
  # environment variable. If neither are set, the integration will fail to
  # start.
  # The format of this is specified here:
  # A working example value for a server with no required password
  # authentication is: "root@(localhost:3306)/"
  data_source_name: <string>

  # A list of collector names to enable on top of the default set.
    [ - <string> ]
  # A list of collector names to disable from the default set.
    [ - <string> ]
  # A list of collectors to run. Fully overrides the default set.
    [ - <string> ]

  # Set a lock_wait_timeout on the connection to avoid long metadata locking.
  [lock_wait_timeout: <int> | default = 2]
  # Add a low_slow_filter to avoid slow query logging of scrapes. NOT supported
  # by Oracle MySQL.
  [log_slow_filter: <bool> | default = false]

  ## Collector-specific options

  # Minimum time a thread must be in each state to be counted.
  [info_schema_processlist_min_time: <int> | default = 0]
  # Enable collecting the number of processes by user.
  [info_schema_processlist_processes_by_user: <bool> | default = true]
  # Enable collecting the number of processes by host.
  [info_schema_processlist_processes_by_host: <bool> | default = true]
  # The list of databases to collect table stats for. * for all
  [info_schema_tables_databases: <string> | default = "*"]
  # Limit the number of events statements digests by response time.
  [perf_schema_eventsstatements_limit: <int> | default = 250]
  # Limit how old the 'last_seen' events statements can be, in seconds.
  [perf_schema_eventsstatements_time_limit: <int> | default = 86400]
  # Maximum length of the normalized statement text.
  [perf_schema_eventsstatements_digtext_text_limit: <int> | default = 120]
  # Regex file_name filter for performance_schema.file_summary_by_instance
  [perf_schema_file_instances_filter: <string> | default = ".*"]
  # Remove path prefix in performance_schema.file_summary_by_instance
  [perf_schema_file_instances_remove_prefix: <string> | default = "/var/lib/mysql"]
  # Database from where to collect heartbeat data.
  [heartbeat_database: <string> | default = "heartbeat"]
  # Table from where to collect heartbeat data.
  [heartbeat_table: <string> | default = "heartbeat"]
  # Use UTC for timestamps of the current server (`pt-heartbeat` is called with `--utc`)
  [heartbeat_utc: <bool> | default = false]
  # Enable collecting user privileges from mysql.user
  [mysql_user_privileges: <bool> | default = false]

The full list of collectors that are supported for mysqld_exporter is:

NameDescriptionEnabled by default
auto_increment.columnsCollect auto_increment columns and max values from information_schemano
binlog_sizeCollect the current size of all registered binlog filesno
engine_innodb_statusCollect from SHOW ENGINE INNODB STATUSno
engine_tokudb_statusCollect from SHOW ENGINE TOKUDB STATUSno
global_statusCollect from SHOW GLOBAL STATUSyes
global_variablesCollect from SHOW GLOBAL VARIABLESyes
heartbeatCollect from heartbeatno
info_schema.clientstatsIf running with userstat=1, enable to collect client statisticsno
info_schema.innodb_cmpmemCollect metrics from information_schema.innodb_cmpmemyes
info_schema.innodb_metricsCollect metrics from information_schema.innodb_metricsyes
info_schema.innodb_tablespacesCollect metrics from information_schema.innodb_sys_tablespacesno
info_schema.processlistCollect current thread state counts from the information_schema.processlistno
info_schema.query_response_timeCollect query response time distribution if query_response_time_stats is ONyes
info_schema.replica_hostCollect metrics from information_schema.replica_host_statusno
info_schema.schemastatsIf running with userstat=1, enable to collect schema statisticsno
info_schema.tablesCollect metrics from information_schema.tablesno
info_schema.tablestatsIf running with userstat=1, enable to collect table statisticsno
info_schema.userstatsIf running with userstat=1, enable to collect user statisticsno
mysql.userCollect data from mysql.userno
perf_schema.eventsstatementsCollect metrics from performance_schema.events_statements_summary_by_digestno
perf_schema.eventsstatementssumCollect metrics of grand sums from performance_schema.events_statements_summary_by_digestno
perf_schema.eventswaitsCollect metrics from performance_schema.events_waits_summary_global_by_event_nameno
perf_schema.file_eventsCollect metrics from performance_schema.file_summary_by_event_nameno
perf_schema.file_instancesCollect metrics from performance_schema.file_summary_by_instanceno
perf_schema.indexiowaitsCollect metrics from performance_schema.table_io_waits_summary_by_index_usageno
perf_schema.replication_applier_status_by_workerCollect metrics from performance_schema.replication_applier_status_by_workerno
perf_schema.replication_group_member_statsCollect metrics from performance_schema.replication_group_member_statsno
perf_schema.replication_group_membersCollect metrics from performance_schema.replication_group_membersno
perf_schema.tableiowaitsCollect metrics from performance_schema.table_io_waits_summary_by_tableno
perf_schema.tablelocksCollect metrics from performance_schema.table_lock_waits_summary_by_tableno
slave_hostsScrape information from ‘SHOW SLAVE HOSTS’no
slave_statusScrape information from SHOW SLAVE STATUSyes