Flush the cache using SQL in Drupal 7

      No Comments on Flush the cache using SQL in Drupal 7

I had to flush the cache on a Drupal 7 site and couldn’t get to the admin.  So, I needed to flush the cache straight on the database layer.

Luckily all the cache tables are named cache_{something}.  Flushing the cache was as simple as running this command on the database:

[code language=”sql”]
TRUNCATE TABLE {database_name}.cache_block;
TRUNCATE TABLE {database_name}.cache_bootstrap;
TRUNCATE TABLE {database_name}.cache_field;
TRUNCATE TABLE {database_name}.cache_filter;
TRUNCATE TABLE {database_name}.cache_form;
TRUNCATE TABLE {database_name}.cache_image;
TRUNCATE TABLE {database_name}.cache_menu;
TRUNCATE TABLE {database_name}.cache_metatag;
TRUNCATE TABLE {database_name}.cache_page;
TRUNCATE TABLE {database_name}.cache_path;
TRUNCATE TABLE {database_name}.cache_token;
TRUNCATE TABLE {database_name}.cache_update;
TRUNCATE TABLE {database_name}.cache_views;
TRUNCATE TABLE {database_name}.cache_views_data;
[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *