Friday, November 21, 2014

cache_rules Errors in Drupal Websites

While building an E-Commerce website, I've encountered the following error

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabasename.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\ "

Let's see how to solve this.

The above error occurs genrally when the cache_rules table/view is corrupt.

The easier way is to truncate the table without dtopping so that we don't need to create it again. But when I went to my phpmyadmin and clicked on this view, I received the following error.

" #1146 - Table 'mydatabasename.cache_field' doesn't exist "

So, now the solution is to drop it and create using same structure.

Execute the following SQL code and get it done. :)

  1. drop TABLE cache_rules;
  2. 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=InnoDB DEFAULT CHARSET=utf8 COMMENT='Cache table for the rules engine to store configured items.';

Refresh the page with error. If the error is gone, fine :) But my case is complex. I received one more error. Below is the same.

PDOException: SQLSTATE[HY000]: General error: 1030 Got error -1 from storage engine: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\ "

For fixing this, I followed this procedure.

If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

No comments:
Write comments