How to permanently enable query cache in MySQL?
You can set this parameter in /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.cnf


Append config directives as follows:

query_cache_size = 268435456
query_cache_type = 1
query_cache_limit = 1048576


Change the values as appropriate to your system!