How to Enable the MySQL Query Cache
The MySQL query cache is used to store a SELECT statement and the output. When the SELECT statement is sent to the database a second time, the result is retrieved from the query cache instead from the database data. This is useful when the same queries are sent to the database on a regular basis, such as in a web based application. To enable the query cache, you must specify the amount of space (size) to allocate for the cache.
Instructions
-
-
1
Log in to the MySQL database as the database administrator.
-
2
Type the statement
SET GLOBAL query_cache_size = 15728640;
to set the cache size to 15 megabytes. You must specify the size in bytes.
-
-
3
Type the statement
SHOW VARIABLES LIKE 'query_cache_size';
to see the size of the query cache.
-
1