mysqlmysql-variables

How to SET have_query_cache = YES?


I've tried to set this by using SET VARIABLE but it said that have_query_cache is read-only

mysql>SHOW VARIABLES LIKE 'have_query_cache';
+------------------+-------+
|    Variable_name | Value |
+------------------+-------+
| have_query_cache |   YES |
+------------------+-------+

Solution

  • For supported versions of MySQL (less than 8.0 or so), you enable the query cache in the server configuration using e.g. the variables query_cache_size and query_cache_type .

    The have_query_cache variable only informs you whether the cache is enabled at present.