# Issues with QAN in PMM 2.42.0: Error 1064 and 1345 when processing SQL queries

**URL:** <https://forums.percona.com/t/issues-with-qan-in-pmm-2-42-0-error-1064-and-1345-when-processing-sql-queries/36274>\
**Category:** PMM 2.x\
**Tags:** pmm, mysql, percona\
**Created:** [January 22, 2025, 8:57am UTC](https://forums.percona.com/t/issues-with-qan-in-pmm-2-42-0-error-1064-and-1345-when-processing-sql-queries/36274 "2025-01-22T08:57:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sistemes](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@sistemes](https://forums.percona.com/u/sistemes)\
**Post date:** [January 22, 2025, 8:57am UTC](https://forums.percona.com/t/issues-with-qan-in-pmm-2-42-0-error-1064-and-1345-when-processing-sql-queries/36274/1 "2025-01-22T08:57:53Z")

</div>

## Description:

I am experiencing issues with **Query Analytics (QAN)** in **PMM 2.42.0** , where certain SQL queries fail to execute and return errors. Specifically:

- Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘? LEFT OUTER JOIN…’ at line 1  
This occurs when processing queries in QAN. The queries work fine when run manually in MySQL.
- Error 1345 (HY000): EXPLAIN/SHOW can not be issued; lacking privileges for underlying table  
This happens when attempting to use the “Explain” functionality in QAN. It appears to be related to insufficient permissions for the user configured in PMM.

## Steps to Reproduce:

- Install PMM Server 2.42.0 on a CentOS 9 Stream server.
- Install PMM Client 2.42.0 on a CentOS 7.9 server.
- Connect PMM Client to PMM Server and add a MySQL database (Percona Server 8.0.40) as a monitored instance.
- Run Query Analytics in the PMM dashboard for a query containing placeholders (`?`).
- Attempt to use the “Explain” feature for a specific query in QAN.

## Version:

PMM Server:\*\* 2.42.0 (CentOS 9 Stream)  
PMM Client:\*\* 2.42.0 (CentOS 7.9)  
Database:\*\* Percona Server for MySQL 8.0.40

## Logs:

Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘? LEFT OUTER JOIN…’ at line 1

Error 1345 (HY000): EXPLAIN/SHOW can not be issued; lacking privileges for underlying table

## Expected Result:

- Query Analytics should process SQL queries without syntax errors.
- The “Explain” feature in QAN should work correctly when analyzing queries.

## Actual Result:

- Query Analytics fails to process certain queries and returns Error 1064.
- The “Explain” functionality fails with Error 1345, indicating insufficient privileges for the configured PMM user.

## Additional Information:

The `performance_schema` is enabled, and `performance_schema_max_sql_text_length` has been increased to capture longer queries. (perfschema)

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [January 22, 2025, 3:49pm UTC](https://forums.percona.com/t/issues-with-qan-in-pmm-2-42-0-error-1064-and-1345-when-processing-sql-queries/36274/2 "2025-01-22T15:49:00Z")

</div>

You need to increase `performance_schema_max_digest_length` to something large, like 4096 or greater. This will solve the 1064 errors.  
The pmm user you created does not have proper permissions to execute EXPLAIN. Grant SELECT to the pmm user and that will solve the 1345 issue.

---

<div class="post-metadata">

**Author:** ![sistemes](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@sistemes](https://forums.percona.com/u/sistemes)\
**Post date:** [January 22, 2025, 3:54pm UTC](https://forums.percona.com/t/issues-with-qan-in-pmm-2-42-0-error-1064-and-1345-when-processing-sql-queries/36274/3 "2025-01-22T15:54:46Z")

</div>

Thank you for the suggestions! After reviewing the current configuration:

1. performance\_schema\_max\_digest\_length`: The current value is already set to 20240, which exceeds the recommended 4096. Therefore, no changes are needed in this regard.
2. Permissions for the `pmm` user:The user `pmm` has the following grants:

- `SELECT`, `RELOAD`, `PROCESS`, `REPLICATION CLIENT`, `SHOW VIEW` on `*.*`
- Specific `SELECT` permissions on the `performance_schema` and another application database.I have also confirmed that `EXPLAIN` works as expected with these permissions. If further adjustments are required, please let me know.

Thanks again for your guidance! Let me know if there’s anything else I should verify or adjust.
