# mysql -u root -p
設置 Query Cache
編輯 /etc/my.cnf 中的 [mysqld]區段
加入 query_cache_size = 64M
64M為建議預設值,最小值為 40K
restart mysqld
/etc/init.d/mysqld restart
查詢 Query Cache 狀態
mysql> show status like ‘%Qcache%’;
+————————-+———+
| Variable_name | Value |
+————————-+———+
| Qcache_free_blocks | 1 |
| Qcache_free_memory | 2086936 |
| Qcache_hits | 1 |Cache命中率增加1
| Qcache_inserts | 1 |
| Qcache_lowmem_prunes | 0 |
| Qcache_not_cached | 0 |
| Qcache_queries_in_cache | 1 |
| Qcache_total_blocks | 4 |
+————————-+———+
8 rows in set (0.00 sec)
重整 Query Cache Memory leak
mysql> flush query cache;
清空 Query Cache Memory
mysql> reset query cache;