phpmysqlquery-cache

How to check query_cache_type value on my server


I have checked the status of query cache by using this query SHOW VARIABLES LIKE ‘%query_cache%’; . Likewise is there any query or command for checking the value of query_cache_type. Any help will be highly appreciated.


Solution

  • Try any of these:

    SHOW GLOBAL VARIABLES LIKE 'query_cache_type';
    +------------------+-------+
    | Variable_name    | Value |
    +------------------+-------+
    | query_cache_type | ON    |
    +------------------+-------+
    
    
    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='query_cache_type';
    +------------------+----------------+
    | VARIABLE_NAME    | VARIABLE_VALUE |
    +------------------+----------------+
    | QUERY_CACHE_TYPE | ON             |
    +------------------+----------------+
    
    
    SELECT @@query_cache_type;
    +--------------------+
    | @@query_Cache_type |
    +--------------------+
    | ON                 |
    +--------------------+
    
    SELECT @@query_cache_type = 'ON' AS is_it_on;
    +----------+
    | is_it_on |
    +----------+
    |        1 |
    +----------+