• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
The Electric Toolbox Blog

The Electric Toolbox Blog

Linux, Apache, Nginx, MySQL, Javascript and PHP articles

  • Applications
  • FCKEditor
  • Apache
  • Windows
  • Contact Us
Home / How to tell if the MySQL Query Cache is enabled

How to tell if the MySQL Query Cache is enabled

The MySQL Query Cache enables query results to be cached so if the same query is run multiple times the second and subsequent times the query are run are amost instant. This short post shows how to tell if the MySQL Query Cache is enabled.

How to tell if the MySQL Query Cache is enabled

From the MySQL command line interface, phpMyAdmin or another MySQL interface, or from your own code, run the following query:

show variables like 'query_cache_size';

If the result is 0 like in the following example, then the query cache is not enabled:

+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| query_cache_size | 0     |
+------------------+-------+

If the result is greater than zero then it is enabled. The following example shows a query cache that is 50MB in size:

+------------------+----------+
| Variable_name    | Value    |
+------------------+----------+
| query_cache_size | 52428800 |
+------------------+----------+

How to enable the query cache

Refer to my "MySQL Query Cache" post which shows how to enable the MySQL Query Cache. It can be done without having to restart the MySQL server process.

Upcoming posts

My upcoming Wednesday MySQL posts will look at some other things that can be done with the MySQL Query Cache. Make sure to subscribe to my RSS feed (below or top right) or follow me on Twitter or Facebook (top right) so you don’t miss out. The next post in this series looks at how to prevent a query from using MySQL’s query cache.

Check Out These Related posts:

  1. MySQL utility commands
  2. Using CSS sprites for image navigation
  3. Disable the MySQL query cache without restarting MySQL
  4. MySQL Query Cache

Filed Under: MySql

Primary Sidebar

Categories

  • Apache
  • Applications
  • Article
  • Case Studies
  • Email Servers
  • FCKEditor
  • HTML And CSS
  • Javascript
  • Linux/Unix/BSD
  • Microsoft SQL Server
  • Miscellaneous Postings
  • MySql
  • Networking
  • Nginx Web Server
  • Offsite Articles
  • OSX
  • PHP
  • Quick Tips
  • RFC – Request for Comments
  • SilverStripe
  • VMWare
  • VPN
  • Windows
  • WordPress

Recent Posts

  • Vim Show Line Numbers
  • Add User To Group Linux
  • Chmod 777 Tutorial
  • How to Copy Directory Linux
  • Linux create user

Copyright © 2021. ElectricToolBox. All Rights Reserved.

  • Contact Us
  • Copyright Info
  • Privacy Policy
  • Sitemap