How to clear the Drupal cache using an SQL Query

 

The BARTON Organization is a Drupal Development Agency in Florida. Contact BARTON today for your Drupal needs; no project is too small or not good enough; we’re here to help you.

Drupal is great, Drupal is good, but Drupal can cause headaches, don’t you agree? Depending on your version, you can come into an issue where you can’t load up your website after importing your database. A lot of people use something called Drush, but there are users out there that do not use that, or maybe Drush is just giving them issues. Anyway, when you get a white screen of death not caused by memory, or your Drupal website keeps redirecting to the old URL; you need to clear your Drupal cache.

The cause? Well, sometimes we’re so busy with our day-to-day, or someone handing off the database isn’t really a Drupal developer so they sent you an SQL file with the cache data. Not a big deal, we have a solution:

SELECT concat('TRUNCATE TABLE `', TABLE_NAME, '`;') FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'cache%'

Run that SQL query and your Drupal cache will be cleared.

Leave a comment

Find the Best SEO in Fort Lauderdale, Florida (Plantation SEO) | Drupal & Worpress Develpment