mysqlquery-cache

Error While setting query_cache_size in mysql


When I tried to set query_cache_size in mysql, But it shows an warning and reset the cache size to 0

 +---------+------+-----------------------------------------------------------------+
| Level   | Code | Message                                                         |
+---------+------+-----------------------------------------------------------------+
| Warning | 1282 | Query cache failed to set size 41984; new query cache size is 0 |
+-
--------+------+-----------------------------------------------------------------+

I tried the query

SET GLOBAL query_cache_size = 41984;

I am using MySQL Server version: 5.5.35-0ubuntu0.12.04.2 (Ubuntu)

So please help me to set query cache size..


Solution

  • You need to first set query_cache_type = 1 in my.cnf and restart MySQL and then set query_cache_size.

    Please have a look at How to set Query cache in MySQL.