Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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 "set global query_cache_size" command to set the size... but when the database is restarted, it goes away.

Thanks.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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!

share|improve this answer
add comment

You have to edit MySQL configuration file and change these parameters accourdingly

query_cache_size - 1-2 MB

query_cache_limit - 1-2 MB

query_prealloc_size - Should be more than default if you have complex queries.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.