MySQL Metrics Prometheus Exporter

A Prometheus exporter for gathering metrics about your MySQL DB

Deploy MySQL Metrics Prometheus Exporter

mysql-metrics-collector

zuchka/railway-mysql-exporter

Just deployed

MySQL Metrics Collector for Railway

Deploy on Railway

How to replace user root with user exporter

This template will work immediately on any railway project that has a MySQL database deployed. However, it uses the root user for access, which is not ideal.

For better security, you should set up a dedicated exporter user in your MySQL DB. The following are detailed instructions for setting that up and adjusting the Railway environmental variables:

  1. log into your MySQL DB locally using Railway's connection procedures. These are listed in your MySQL details page.

  2. run the following commands to create a new user named exporter. Be sure to replace XXXXXXXX with a strong password of your choosing:

CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'XXXXXXXX' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
  1. Return to the Railway UI. Navigate to your MySQL Collector service and add one new environmental variable: create a key called MYSQL_EXPORT_PASSWORD and set the value to your new password. The MYSQL_EXPORT_USER variable is already set to exporter.

  2. Update the Dockerfile and the .my.cnf file in your github repo. The appropriate replacement lines are already present, but commented out. Comment-out the old lines and uncomment these new lines. Push your changes. Railway will redeploy the collector with the new settings. Your collector is now using a dedicated exporter user instead of the root user!


Template Content

mysql-metrics-collector

zuchka/railway-mysql-exporter

More templates in this category

View Template

OpenTelemetry Collector and Backend

OpenTelemetry Collector with Backend Stack


View Template

pgweb | Postgres UI

View and query your Postgres instance with a sleek and minimalistic UI.


View Template

Elasticsearch-Kibana

Elasticsearch is a search engine based on the Lucene library.