tags:

views:

45

answers:

2

How can I set the query cache of MySql?

My "my.ini" file doesn't contain the variable mysql_query_type or mysql_query_size at all...

How are these set?

Can they be set from PHP?

Thanks

A: 

The mysql query cache size configuration is usually located in the my.ini. Since it is a server configuration, it usually shouldn't be allowed that scripts like php change its configuration. If I remember correctly, the mysql query cache is usually on unless you haven't compiled mysql without it.

Here are more detailed information on how it works, how it is configured, and what initialization variables are to be used.

Here are more detailed information on how you can modify the behaviour using dynamic system variables.

I haven't used phpmyadmin for a long time, so I can't answer on how these values are easily accessible. With SHOW VARIABLES LIKE '%query%'; it should be easy to access them anyway.

Björn
can I use phpMyAdmin for this? and what section under my.ini should I set it?
Camran
I've added a bit more detail into my initial reply.
Björn
A: 

You may enable query caching by altering the query-cache-type value in your MySQL configuration file. You may not change it from PHP, however you may clear it by sending the following query to MySQL: RESET QUERY CACHE.

Johannes Gorset