Here is how to reset your cache_rules table, using a stable Drupal installation.
Get cache_rules structure from clean database
You can get SQL text to drop/add the cache_rules table via the following steps:
- Log in to phpMyAdmin on a functional Drupal site.
- Click on the columns section under the cache_rules table
- Click the Export button
- Click 'Custom' to show all options
- Under 'Output' click 'view output as text'
- Under 'Format-specific options' choose 'structure'
- Under 'Object creation options' check 'Add DROP TABLE / TRIGGER statement'
- Copy the text displayed, or see below (sorry for the formatting)
Here is the SQL code to drop and add the table (thanks duckx!).
DROP TABLE cache_rules ;
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.';
Drop/add the cache_rules table
Now navigate to the other database, using phpMyAdmin.
- Make a full backup of the database
- After the backup has been saved, click the SQL tab
- Paste the text into the text box (removing any existing text)
- Click 'Go'