snippetsqlMinor
How to permanently enable query cache in MySQL?
Viewed 0 times
permanentlyenablequerymysqlcachehow
Problem
I want to know if there's a way to permanently set the size of my query cache and to make sure it's always enabled.
Right now, I'm just using the
Right now, I'm just using the
set global query_cache_size command to set the size, but when the database is restarted it goes away.Solution
You can set this parameter in
Append config directives as follows:
Change the values as appropriate to your system!
/etc/my.cnf on Red Hat or /etc/mysql/my.cnf on Debian (other systems have the my.cnf file in various locations):# vi /etc/my.cnfAppend config directives as follows:
query_cache_size = 268435456
query_cache_type = 1
query_cache_limit = 1048576Change the values as appropriate to your system!
Code Snippets
# vi /etc/my.cnfquery_cache_size = 268435456
query_cache_type = 1
query_cache_limit = 1048576Context
StackExchange Database Administrators Q#50877, answer score: 6
Revisions (0)
No revisions yet.