MySQL exposes useful information about its activity and health, but Prometheus needs that information in a compatible metrics format. mysqld_exporter queries selected database measurements and publishes them for Prometheus to collect. Teams can use the results to investigate database load and build alerts around the behavior their applications depend on. It needs a database account with appropriate monitoring permissions. Collector choice and connection limits matter because monitoring queries themselves consume database resources.
Current guidance
Current upstream documentation describes a dedicated monitoring account, selected collectors and both single-target and multi-target operation. The exporter’s compatibility list is not a statement that old MySQL or MariaDB versions remain supported by their database vendors.
Use an account with the documented grants required by your chosen collectors, and constrain concurrent connections so monitoring does not become a database load problem. Match host-specific database grants to the source address the server actually observes; localhost inside one container is not another pod. Keep credentials in mounted configuration or an equivalent secret mechanism, never a public scrape URL.
The recovered example’s DATA_SOURCE_NAME environment variable was removed in mysqld_exporter 0.15.0. Migrate credentials to a mounted my.cnf-style file, or use the documented connection flags with MYSQLD_EXPORTER_PASSWORD. Compare collector flags, TLS settings and metric names against the old chart. In multi-target mode, review the probe endpoint and auth-module mapping carefully and restrict who can request targets. Exercise a valid account, denied account and unavailable server, then check alert behavior and scrape duration. This advisory does not claim a verified deployment against your database version.
Historical upstream link check · 2026-10-09
The recorded upstream address responded successfully (HTTP 200) on 2026-10-09. GitHub does not mark prometheus/mysqld_exporter archived or disabled; this does not establish active maintenance, support or compatibility. Link availability does not certify the historical installation instructions or current security support.
Website availability is separate from project, chart and image support. Use the current guidance and primary sources on this page to assess the distribution.
Historical Kubedex content
Preserved for context. Commands, versions, prices and results below reflect the original research.
Prometheus exporter for MySQL server metrics. This chart bootstraps a Prometheus mysql exporter deployment on a Kubernetes cluster using the Helm package manager. The exporter can connect to mysql directly or using the Cloud SQL Proxy.
Supported MySQL versions: 5.5 and up.
NOTE: Not all collection methods are supported on MySQL < 5.6
Monitoring MySQLd with Prometheus
The Prometheus ecosystem contains a multitude of integrations, both officially supported and third party. Let’s have a look at how to use the mysqld_exporter.
MySQL is a popular database system, which exposes a wide variety of metrics but not in a format Prometheus can directly consume. The mysqld_exporter bridges this gap.
I’m going to assume you already have a working MySQLd installed. We first need to create a user that can connect locally with appropriate permissions:
CREATE USER ‘mysqld_exporter’@’localhost’ IDENTIFIED BY ‘a_password’;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO ‘mysqld_exporter’@’localhost’
WITH MAX_USER_CONNECTIONS 3;
Then download and run the mysqld_exporter:
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.9.0/mysqld_exporter-0.9.0.linux-amd64.tar.gz
tar -xzf mysqld_exporter-0.9.0.linux-amd64.tar.gz
export DATA_SOURCE_NAME=’mysqld_exporter:[email protected] (retired contact or submission link)(/var/run/mysqld/mysqld.sock)/’
./mysqld_exporter
You may need to adjust the location of the Unix socket.
If you visit http://localhost:9104/metrics you’ll see your metrics!
Let’s setup a Prometheus to scrape the exporter:
wget https://github.com/prometheus/prometheus/releases/download/v2.0.0/prometheus-2.0.0.linux-amd64.tar.gz
tar -xzf prometheus-2.0.0.linux-amd64.tar.gz
cd prometheus-*
cat <<‘EOF’ > prometheus.yml
global:
scrape_interval: 10s
evaluation_interval: 10s
scrape_configs:
– job_name: ‘mysqld’
static_configs:
– targets:
– localhost:9104
EOF
./prometheus &
From there you can go to http://localhost:9090/graph and plot expressions such as irate(mysql_global_status_queries[1m]) to get the query rate.
The mysqld_exporter can provide a wide wealth of information, however, for performance reasons most of this is disabled by default. The official docs have the flags you can use to enable more metrics.
Sources & further reading
Spotted something that needs another look?
Help improve this page →