0

I just did a clear cache in the browser and also in the terminal with "drush cc all" and I'm getting the following error. I'm not sure what to do next as I can't clear the cache on the site, but it seems like the site is working fine. I'm on Drupal 7.32.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'phone_drup.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array()

in cache_clear_all() (line 167 of /home/phone/public_html/includes/cache.inc).

2

I ran into the same error message on an existing client Drupal install when enabling Rules through Drush. The cause was probably that the table was removed without uninstalling the module. Uninstalling it, clearing the cache and then enabling it again solved the problem. In Drush commands:

drush pm-uninstall rules
drush cc all
drush en rules
2

It's related to this: https://www.drupal.org/node/2160645#comment-9904817

it seems that this is a reoccurring problem for drupal 7 sites. I'm not sure why it happens but it seems the fix is to DROP the cache_rules table and then recreate it again. But sometimes it doesnt recreate the table as it might throw an error -1 on recreation.

I went into the terminal and to the mysql console and did the following:

DROP TABLE cache_rules ;

FYI: I had to set the engine parameter to blackhole in order for it to work. Default it is innodb. I'm not sure what blackhole is for. Just copy and paste into the terminal:

CREATE TABLE IF NOT EXISTS `cache_rules` (
  `cid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.',
  `data` longblob COMMENT 'A collection of data to cache.',
  `expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
  `created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
  `serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
  PRIMARY KEY (`cid`),
  KEY `expire` (`expire`)
) ENGINE=blackhole DEFAULT CHARSET=utf8 COMMENT='Cache table for the rules engine to store configured items.';
0

Try to (temporary) disable the module that this table is related to (which created the table when it got enabled). The retry the clear cache, and enable the module again.

According to the Drupal Support forum, it seems to be the Rules module. A few options to move forward:

  • Some type of fix (or at least work around), is to just drop and recreate that table.
  • Perform REPAIR TABLE cache_rules;.
  • Just create the table (if it doesn't exist).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.