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:
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`@`%` |
| GRANT SELECT ON `performance_schema`.* TO `db-o11y`@`%` |
+-------------------------------------------------------------------+- If the user lacks required grants, refer to the Create a monitoring user and grant required privileges section in the get started article.
Check object-level access for detailed data
Ensure that the db-o11y user has access to the schemas and objects you analyze.
- If a schema lacks detailed data, refer to the Grant object privileges for detailed data section in the get started article.
Check that tracking of monitoring user queries is disabled
Confirm that the db-o11y user has the correct setup_actors settings:
SELECT * from performance_schema.setup_actors where USER = 'db-o11y';
+------+---------+------+---------+---------+
| HOST | USER | ROLE | ENABLED | HISTORY |
+------+---------+------+---------+---------+
| % | db-o11y | % | NO | NO |
+------+---------+------+---------+---------+- If the settings are enabled, refer to the Disable tracking of monitoring user queries section in the get started article.
Confirm Performance Schema is enabled
Verify the Performance Schema state:
SHOW VARIABLES LIKE 'performance_schema';Expected result: Value is ON.
- If
ValueisOFF, refer to the Enable Performance Schema section in the get started article.
Validate digest length variables
Verify max_digest_length:
SHOW VARIABLES LIKE 'max_digest_length';Expected result: Value is 4096.
Verify performance_schema_max_digest_length:
SHOW VARIABLES LIKE 'performance_schema_max_digest_length';Expected result: Value is 4096.
- If values differ, refer to the Increase digest length limits section in the get started article.
Confirm SQL text length for samples (optional)
If you plan to disable query redaction through the query_samples.disable_query_redaction setting, verify performance_schema_max_sql_text_length:
SHOW VARIABLES LIKE 'performance_schema_max_sql_text_length';Expected result: Value is 4096.
- If the value is lower than expected, refer to the Increase unredacted SQL text length limits (optional) section in the get started article.
Verify CPU consumers for query samples (optional)
Check whether the events_statements_cpu consumer is enabled:
SELECT * FROM performance_schema.setup_consumers WHERE NAME = 'events_statements_cpu';Expected result: Value is YES.
- If the consumer is disabled, re-enable it.
- The consumer disables when the database restarts. Plan for re-enablement as needed.
- If you prefer Alloy to auto-enable Performance Schema consumers, refer to the Grant privileges to auto-enable consumers (optional) section in the get started article.
Verify wait events consumers for query samples (optional)
Check whether the waits events consumers are enabled:
SELECT * FROM performance_schema.setup_consumers WHERE NAME IN ('events_waits_current', 'events_waits_history');Expected result: Value is YES.
- If the consumers are disabled, re-enable it.
- The consumers disable when the database restarts. Plan for re-enablement as needed.
- If you prefer Alloy to auto-enable Performance Schema consumers, refer to the Grant privileges to auto-enable consumers (optional) section in the get started article.
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.



