How to set cache in mysql: 1. Turn on the self-cache function [show variables like “�che%”]; 2. Set the self-cache to 32M [set global query_cache_size = 1024 * 1024 * 32;] .
How to set cache in mysql:
1. You need to enable MySQL’s own cache function
# show variables like “%cache%”
2,query_cache_type
: The startup state of MySQL's own cache is enabled by default, but there is no space size
query_cache_size
: The size of MySQL's own cache, the unit is B (byte)
If you need to set MySQL's own cache to 32 M
# set global query_cache_size = 1024 * 1024 * 32;
Do some comparison tests
query_cache_size=0;
3. Query
4. Enable MySQL’s own cache (32M space)
5. When the word case of the query statement is modified, the query result remains unchanged, but MySQL's own cache thinks this is a different query and will cache it here (MySQL's own cache is strictly based on the case of the SQL statement) )
More related free learning recommendations:mysql tutorial(video)
The above is the detailed content of How to set up cache in mysql. For more information, please follow other related articles on the PHP Chinese website!