Enable query cache in mysql

@mit $ingh. June 18, 2015 Comments

The server variable named "have_query_cache" indicates whether the query cache is available or not:

mysql> SHOW VARIABLES LIKE 'have_query_cache';

output:

Variable_nameValue
have_query_cacheYES

 

To see all the variables of query cache execute the below query:

mysql> SHOW VARIABLES LIKE 'query%';

output:

Variable_nameValue
query_alloc_block_size8192
query_cache_limit1048576
query_cache_min_res_unit4096
query_cache_size1048576
query_cache_typeOFF
query_cache_wlock_invalidateOFF
query_prealloc_size8192

 

To enable query cache set the above variables by execute the below query;

mysql> SET GLOBAL query_cache_size = 16777216;
mysql> SET GLOBAL query_cache_type = 1;
mysql> SET GLOBAL query_cache_limit = 1048576;

 

  • caching
  • mysql-error