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’

Then download and run the mysqld_exporter:

tar -xzf mysqld_exporter-0.9.0.linux-amd64.tar.gz
export DATA_SOURCE_NAME=’mysqld_exporter:[email protected](/var/run/mysqld/mysqld.sock)/’
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:

tar -xzf prometheus-2.0.0.linux-amd64.tar.gz
cd prometheus-*
cat <<‘EOF’ > prometheus.yml
scrape_interval: 10s
evaluation_interval: 10s
– job_name: ‘mysqld’
– targets:
– localhost:9104
./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.

Tell us about a new Kubernetes application


Never miss a thing! Sign up for our newsletter to stay updated.


Discover and learn about everything Kubernetes