1296
MySQLerrorconfigurationhigh confidence
The query cache is disabled
Production Risk
Low — query executes without caching; may affect performance expectations.
What this means
A SQL_CACHE or SQL_NO_CACHE hint was used but the query cache is disabled (query_cache_type = OFF).
Why it happens
- 1query_cache_type is set to OFF or 0
- 2Query cache was removed entirely in MySQL 8.0
How to reproduce
trigger — this will error
trigger — this will error
SELECT SQL_CACHE * FROM t;
expected output
ERROR 1296 (HY000): The query cache is disabled; to enable, set query_cache_type to a value other than OFF
Fix 1
Remove the SQL_CACHE hint
Remove the SQL_CACHE hint
SELECT * FROM t;
Why this works
The hint is unnecessary; remove it for compatibility with MySQL 8.0.
Fix 2
Enable query cache on MySQL 5.7
Enable query cache on MySQL 5.7
SET GLOBAL query_cache_type = 1;
Why this works
Re-enables the query cache on MySQL 5.7 (not available in 8.0).
What not to do
✕
Version notes
Sources
Official documentation ↗
MySQL 8.0 — 1296 ER_QUERY_CACHE_DISABLED
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev