• 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 / Disable the MySQL query cache without restarting MySQL

Disable the MySQL query cache without restarting MySQL

The MySQL query cache enables caching of queries which, in theory, should speed querying the database up. It’s possible to disable the MySQL query cache without restarting the server, although you also need to edit the configuration file to make the changes stick on restart.

Query to disable the cache

From the MySQL command line, a application like phpMyAdmin, or from a script, run the following SQL command to disable the query cache:

SET GLOBAL query_cache_size = 0;

This will take effect immediately. You will also need to modify the MySQL configuration file to keep it disabled on reboot. Locate the query_cache_size setting in the file and set it to 0.

I needed to do this today myself because one of the websites I manage kept getting locks which were preventing other queries from running, and we decided to shut off the query cache to see if it makes a difference. It’s too early so far to tell whether or not it has.

Check out the related posts below for more information about the query cache and how to enable it in the first place.

Check Out These Related posts:

  1. MySQL utility commands
  2. Running queries from the MySQL Command Line
  3. MySQL Query Cache
  4. How to tell if the MySQL Query Cache is enabled

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