Cache en MySQL

Verificar que tenga MySQL cache

mysql> show variables like 'have_query_cache';  
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| have_query_cache | YES   |
+------------------+-------+

Ver Configuración actual del caché

mysql> show variables like 'query%';  
+------------------------------+---------+
| Variable_name                | Value   |
+------------------------------+---------+
| query_alloc_block_size       | 8192    |
| query_cache_limit            | 1048576 |
| query_cache_min_res_unit     | 4096    |
| query_cache_size             | 8388608 |
| query_cache_type             | ON      |
| query_cache_wlock_invalidate | OFF     |
| query_prealloc_size          | 8192    |
+------------------------------+---------+

Actualizar los valores a conveniencia:

SET GLOBAL query_cache_size = 8388608;  
SET GLOBAL query_cache_limit = 1048576;  
SET GLOBAL query_cache_type = 1;  

Verificar que esté funcionando:

mysql> SHOW STATUS LIKE 'Qc%';  
+-------------------------+--------+
| Variable_name           | Value  |
+-------------------------+--------+
| Qcache_free_blocks      | 65     | 
| Qcache_free_memory      | 201440 | 
| Qcache_hits             | 18868  | 
| Qcache_inserts          | 2940   | 
| Qcache_lowmem_prunes    | 665    | 
| Qcache_not_cached       | 246    | 
| Qcache_queries_in_cache | 492    | 
| Qcache_total_blocks     | 1430   | 
+-------------------------+--------+
8 rows in set (0.00 sec)  

Para persistir los cambios entre reinicios, hay que modificar el archivo de configuración, usualmente ubicado en /etc/mysql/my.cnf

query_cache_size = 268435456  
query_cache_type=1  
query_cache_limit=1048576  

Fuente