Grafana Cloud

Troubleshoot MySQL

Identify and resolve issues from each step of the MySQL get started guide. Use these checks to verify your database configuration and confirm that Grafana Alloy is wired correctly. These steps do not repeat setup. If a setting is incorrect, refer back to the corresponding step in the get started article to apply the change.

What you’ll achieve

In this article, you:

  • Validate MySQL user permissions and object access.
  • Confirm Performance Schema and related variables.
  • Verify optional consumers for query samples and wait events.
  • Troubleshoot Alloy configuration for logs and metrics forwarding.

Before you begin

Make sure you can connect to your MySQL server and have sufficient privileges to run validation queries. Keep the MySQL get started article open to reapply any missing configuration.

Verify monitoring user and base privileges

Confirm that the db-o11y user exists and has the expected permissions:

SQL
SHOW GRANTS FOR 'db-o11y'@'%';

+-------------------------------------------------------------------+
| Grants for db-o11y@%                                              |
+-------------------------------------------------------------------+
| GRANT PROCESS, REPLICATION CLIENT ON *.* TO `db-o11y`@`%`         |
| GRANT SELECT, SHOW VIEW ON *.* TO `db-o11y`@`%`                   |
+-------------------------------------------------------------------+

Check object-level access for detailed data

Ensure db-o11y has access to the schemas and objects you analyze.

Confirm Performance Schema is enabled

Verify the Performance Schema state:

SQL
SHOW VARIABLES LIKE 'performance_schema';

+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| performance_schema | ON    |
+--------------------+-------+

Validate digest length variables

Verify max_digest_length:

SQL
SHOW VARIABLES LIKE 'max_digest_length';

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| max_digest_length | 4096  |
+-------------------+-------+

Verify performance_schema_max_digest_length:

SQL
SHOW VARIABLES LIKE 'performance_schema_max_digest_length';

+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| performance_schema_max_digest_length | 4096  |
+--------------------------------------+-------+

Confirm SQL text length for samples (optional)

If you plan to disable query redaction, verify performance_schema_max_sql_text_length:

SQL
SHOW VARIABLES LIKE 'performance_schema_max_sql_text_length';

+----------------------------------------+-------+
| Variable_name                          | Value |
+----------------------------------------+-------+
| performance_schema_max_sql_text_length | 4096  |
+----------------------------------------+-------+

Verify CPU consumer for query samples (optional)

Check whether the events_statements_cpu consumer is enabled:

SQL
SELECT * FROM performance_schema.setup_consumers WHERE NAME = 'events_statements_cpu';
  • If the consumer is disabled, re-enable it. If you rely on Alloy to auto-enable it, refer to Troubleshoot Alloy components.
  • The consumer disables when the database restarts. Plan for re-enablement as needed.

Verify wait event consumers for query samples (optional)

Check whether the waits consumers are enabled:

SQL
SELECT * FROM performance_schema.setup_consumers WHERE NAME IN ('events_waits_current', 'events_waits_history');

Troubleshoot Alloy configuration

Validate component wiring, labels, scrape targets, and write endpoints. For guidance on exporters, components, relabeling, scrape jobs, and remote writes, refer to Troubleshoot Alloy components.

Next steps

For setup instructions, refer to Set up MySQL.