2

So I am in a bind and have no idea where to go. I get the following message now after I tried to add a new field to a content type:

Error message
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wrrc-data.cache_field' doesn't exist: DELETE FROM {cache_field} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => field\_info\_types:% ) in cache_clear_all() (line 167 of C:\data\htdocs\wrrc-data\includes\cache.inc).

I have looked everywhere and cannot seem to find the right answer for me, and am hoping someone who has dealt with this hellish nightmare might be able to help.

I have tried dropping the "non-existent" (even though I see it in the file directory) 'cache_field' table, it "supposedly" works and so I go on to create a new table (to replace the failed one). All the sites I went to for this problem suggested the following code:

CREATE TABLE IF NOT EXISTS `cache_field` (

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='Generic cache table for caching things not separated out...';

But after starting this sql command, I get the following error:

#1005 - Can't create table 'wrrc-data.cache_field' (errno: -1) (Details…) 

Doesn't give me any more information (even the supposed "Details" page doesn't give me squat, all it talks about is the background for InnoDB, nothing to add to the error at hand.

Does anyone have any suggestions? I really don't want to recreate the site at all, as that is what some had suggested on other sites, but this is beginning to wear me down. If I do need to just create another site, is there a way to streamline the process of bringing over my data and formatting without having the error hitch a ride?

Thanks in advance, I really appreciate it. Matt

1

3 Answers 3

1

I already answered this question here and it solved the problem. Many people who work with Drupal face this problem. This is the answer:

I had the same problem, and in my case the issue was the database tables engine: By default it is InnoDB and (for some reasons I still don't have to understand) Drupal reports this error.

You must change the database engine to MyISAM. First off, you must be sure the tables that are going to be created by Drupal have MyISAM as engine: In /includes/database/mysql/schema.inc, look for createTableSql($name, $table), and change InnoDB to MyISAM; then, save it.
Since you have a few tables in your database they must be changed to MyISAM as well, so simply export the database as .sql file open it in a text editor and replace Engine=InnoDB with Engine=MyISAM. Now in the server phpmyadmin delete all the tables of the DB and import the new .sql file in there. In this way, all your tables and the tables that will be created by Drupal are MyISAM.

4
  • Yours is definitely the most promising, (mainly because its literally the only thing I hadn't done/found. However, after exporting an sql file, editing it with the changes you suggested I now have run into a different issue. I get the following error "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'phpMyAdmin SQL Dump -- version 4.3.11 -- phpmyadmin.net -- -- Host: 1' at line 1" Here is the link to the file link (its in text for you)
    – Matthew
    Jul 10, 2015 at 4:31
  • There must be something simple I am doing wrong, I just am not sure exactly what it could be at this point. If you don't see anything I may just start from the beginning and make sure I try and avoid the problem before it starts.
    – Matthew
    Jul 10, 2015 at 4:33
  • I will check it out. But always change the schema file before installing drupal
    – M a m a D
    Jul 10, 2015 at 9:27
  • To export your .sql file completely empty your old database. Also SET SQL_MODE and SET time_zone is unnecessary.
    – M a m a D
    Jul 10, 2015 at 9:39
1

Chechout the link at https://www.drupal.org/node/2144205#comment-9288889 which suggests this:

If your cache_field table is corrupt, you should be able to clear it by running update.php or cc all from drush. If you want to empty the table contents without deleting and rebuilding the schema, you can delete from cache_table or truncate cache_table.

Another suggestion is in the same link, located at https://www.drupal.org/node/2144205#comment-8368871 ...

If neither of those links help (or don't work), then investigate which module creates that table as part of it's install/enable process. Then uninstall and re-install that module ...

0

When it's about designing content types, you shouldn't act on the database structure. My suggestion is to clone your content type and work on the new one. If this is not working, make a brand new one

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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