---
title: "Troubleshoot MySQL | Database Observability documentation"
description: "Troubleshoot MySQL setup steps for Database Observability and validate configuration."
---

# 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 set up guide 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 set up guide 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 ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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`@`%`                   |
| 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](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#create-a-monitoring-user-and-grant-required-privileges) section in the set up guide.

## 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](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#grant-object-privileges-for-detailed-data) section in the set up guide.

## Check that tracking of monitoring user queries is disabled

Confirm that the `db-o11y` user has the correct `setup_actors` settings:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
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](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#disable-tracking-of-monitoring-user-queries) section in the set up guide.

## Confirm Performance Schema is enabled

Verify the Performance Schema state:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
SHOW VARIABLES LIKE 'performance_schema';
```

Expected result: Value is `ON`.

- If value is `OFF`, refer to the [Enable Performance Schema](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#enable-performance-schema) section in the set up guide.

## Validate digest length variables

Verify `max_digest_length`:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
SHOW VARIABLES LIKE 'max_digest_length';
```

Expected result: Value is `4096`.

Verify `performance_schema_max_digest_length`:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
SHOW VARIABLES LIKE 'performance_schema_max_digest_length';
```

Expected result: Value is `4096`.

- If values differ, refer to the [Increase digest length limits](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#increase-digest-length-limits) section in the set up guide.

## 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`:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
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 SQL text length limits (optional)](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#increase-sql-text-length-limits-optional) section in the set up guide.

## Verify CPU consumers for query samples (optional)

Check whether the `events_statements_cpu` consumer is enabled:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
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)](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#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:

SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```sql
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)](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/mysql/#grant-privileges-to-auto-enable-consumers-optional) section in the get started article.
- If consumers are enabled but wait events still don’t appear, verify that `wait_event_min_duration` in the Alloy `query_samples` block isn’t set too high. The default value of `"1us"` filters out sub-microsecond events. Set it to `"0s"` to collect all wait events.

## Check minimum duration filters (optional)

If the Query Samples or Wait Events tabs show fewer entries than expected, the Alloy `query_samples` block may be filtering out short-duration events.

Two settings control minimum duration filtering:

- `sample_min_duration` — Minimum elapsed time for a query sample to be collected. Defaults to `"0s"` (no filtering).
- `wait_event_min_duration` — Minimum duration for a wait event to be collected. Defaults to `"1us"`.

To verify, check the `query_samples` block in your Alloy configuration:

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
query_samples {
  sample_min_duration     = "0s"
  wait_event_min_duration = "0s"
}
```

- Set both values to `"0s"` to disable filtering and collect all samples and wait events.
- If `wait_event_min_duration` is greater than `sample_min_duration`, Alloy logs a warning. Ensure `wait_event_min_duration` is less than or equal to `sample_min_duration` for consistent filtering behavior.
- For guidance on tuning these values, refer to [Tune Alloy collection](/docs/grafana-cloud/monitor-applications/database-observability/configure/tune-alloy-collection/#query_samples).

## 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](/docs/grafana-cloud/monitor-applications/database-observability/troubleshoot/alloy/).

## Next steps

For setup instructions, refer to [Set up MySQL](/docs/grafana-cloud/monitor-applications/database-observability/set-up/mysql/).
