0

I finished migration from 5.1 to 5.6, and (with the same queries as before) mysql complains right away about:

General error: 1651 Query cache is disabled; restart the server with query_cache_type=1 to enable it

I don't want the query cache enabled (that's an app with lots of writting), and my file my.ini looks like this:

# The MySQL server
[mysqld]
# ... other parameters...

query_cache_type = 0
query_cache_size = 0

Also, on connect, my php connection wrapper always executes

SET SESSION query_cache_type = OFF

What I don't understand is

  1. Why the parameters apparently do not work
  2. Why does mysql even have to complain about a parameter that is disabled when it is the user's choice to do so.

Enlightment needed - Thanks!

3
  • I think the SET SESSION query_cache_type = OFF is causing this. Have you read (in the Query Cache Configuration page) that: "If you set query_cache_type at server startup (rather than at runtime with a SET statement), only the numeric values are permitted." Commented May 19, 2013 at 15:47
  • And since the server starts with query_cache_type = 0, I don't think there is any reason to use that SET. Commented May 19, 2013 at 15:50
  • @ypercube that was it. Please add your comment as an answer and I'll accept it. Changing it to SET ... = 0 does not change anything, removing totally the setting does. I agree that it is overkill to double specify the parameter on server and client's sessions, but to me it should not behave like this anyway.
    – Sebas
    Commented May 19, 2013 at 15:57

1 Answer 1

2

I think the SET SESSION query_cache_type = OFF is causing this. In the Query Cache Configuration page it states:

If you set query_cache_type at server startup (rather than at runtime with a SET statement), only the numeric values are permitted.

And since you are starting the server with cache disabled, there is no need to use that SET anyway.

As to why it throws an error (both with = OFF and = 0), it may have to do with this note in Server System Variables page:

...

If the server is started with query_cache_type set to 0, it does not acquire the query cache mutex at all, which means that the query cache cannot be enabled at runtime and there is reduced overhead in query execution.

My interpretation is that the variable has both Global and Session scope but only if it not set to off at startup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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