Drupal Clear Cache SQL Commands should be one of your last resorts. But if for any reason you find yourself in a situation where you would need to use SQL commands to clear your Drupal 7 cache the following lines of SQL may come in handy.
Drupal Clear Cache SQL Commands
I strongly recommend trying to clear the cache using other conventional methods, however if there is nothing else here are the Drupal Clear Cache SQL Commands that will do the dirty work for you.
TRUNCATE TABLE CACHE;
TRUNCATE TABLE cache_block;
TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_field;
TRUNCATE TABLE cache_filter;
TRUNCATE TABLE cache_form;
TRUNCATE TABLE cache_image;
TRUNCATE TABLE cache_menu;
TRUNCATE TABLE cache_page;
TRUNCATE TABLE cache_path;
TRUNCATE TABLE cache_token;
TRUNCATE TABLE cache_update;
Probably the fastest and easiest way to clear your cache is using Drush through the command line. You can find Drush on Github. On a Windows machine you can try to use the Drush Windows Installer. For a Windows user who’s local development site has cache problems and Drush is not an option at this time, these few lines could save the day. Other Alternatives for Clearing the Cache if using SQL Commands is not an option for you, or you think it’s too risky can be found on Drupal.org here.
People on Stack Overflow have found various other ingenious ways on how to clear their Drupal Cache, I’m sure some of you might find this useful.
I hope you found this article useful.
Please share your thoughts, knowledge in the comment section below, and help me improve this article.
What is the difference between drush cc all and clearing cache tables manually?
What tables will be cleared by drush cc all? The same as in your snippet?