I'm having a very strange problem. I have a website on Pantheon (Nginx) that I attempting to import into my local dev environment, but when I import, it is failing when it gets to the cache_rules table. So I dropped the cache_rules table on the server DB, dumped the DB, and imported it, and then tried to re-create the cache_rules table with the following command:

  `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.';

which I found here. I am running the command in phpMyAdmin.

However, when I do that, I get this error message:

"Can't create table errno: -1"

I've attempted to search for this but the explanations suggested that it was usually caused by trying to create a table that had a key that depended on another table that hadn't been created yet, but that is not the case here.

I can run the exact same command above with a different table name (e.g., cache_rules2) and a cache_rules2 table will be created without a problem-- so it's only the specific name cache_rules that is causing this issue, whatever it is.

How can I further debug this to figure out why it suddenly doesn't want to create a cache_rules table?

  • This won't be related to Drupal, it sounds like your MySQL db is in an inconsistent state. You should check the MySQL server logs and perform checks on the server itself (or get your server admin to do it if you don't have access). You can easily prove the point by creating a brand new database and executing the same query against it. If it works, your original DB is out-of-whack. If not, the server is out-of-whack – Clive Apr 15 '15 at 13:34

When importing/exporting databases from/to Drupal try using Backup & Migrate as this only attempts to backup the structure of the cache tables rather than the data too.

| improve this answer | |

In this case, as @Clive noted, the problem was with corruption in the database. I was able to fix the problem by dropping the database, and then manually deleting what still remained (but shouldn't have):

sudo rm -rf /var/lib/mysql/my_db_name
| improve this answer | |

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.