I hope this is the right place to ask this. I have been working with this drupal site for months now and have never had a problem as far as the database was concerned. Seemingly out of nowhere I started getting this error popping up all over the place. It has gotten to the point where I cannot complete the site unless it is dealt with.
The error occurs every time I try to clear the site cache or try to use update.php. When I try to clear cache I get this error:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sitename_databaseName.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 163 of /home/sitename/public_html/includes/cache.inc).
Keep in mind the "sitename" and "databaseName" are fillers for the actual website's name.
I have scoured the web in the last week trying to find some way to deal with this but the closest thing I found said to create the table it is looking for through phpMyAdmin. Problem with that is when I try to create the database it starts asking for input values for the rows, and I don't have a clue what the table is used for or how it should be formatted and it also wont let me create an empty table. If you guys haven't realized by now I am not the biggest database guy, pretty much know the basics of mysql and that's pretty much the extent of it.
Please if anyone knows something I can try let me know. This site is so close to completion and this one error is halting all progress. I really need some help on this one.
Comments
=-=
Looks like a module wasn't installed correctly or uninstalled correctly. The trick is to locate which module intended to install the table.
rules.module maybe?
Thanks, quick question though
Thank you for the super fast reply! Is there any way to determine exactly which module might be causing the issue? Or is it mostly just a process of elimination?
=-=
well it wouldn't be a core module. Thus you can eliminate them.
In attempting to try and narrow the window, again, I ask ... is the rules.module installed? or has it ever been installed?
Yes
yeah it is. Sorry, didn't notice that you asked in the first comment.
=-=
If that module is disabled, does the site still throw the error?
Apologies but
Sorry to be nitpicky about this because I know you are trying to help but to disable the rules module on the site would mean to also disable more than half the other modules, a lot of which are important. I will do it if it is most likely the issue but I really don't want to risk ending up in a worse state than I am now. I have had the rules module installed and working for months before the error started to occur. what would cause it to suddenly start throwing this error?
=-=
Fear, Uncertainty and Doubt is why one utilizes the documented best practice of using a copy of the prod site in a dev environment.
I'm focusing on the rules.module because of the name of the table being cache_rules - It may not be the rules module but it was worth the ask in an effort to debug. It would seem to me to be the first place to check as I can't imagine another module that would use the rules namespace. I hesitate to guess at why the table would be missing at this stage.
you are welcome to use google as I have been to try and narrow down where the missing table may be from. I've found no specific's which indicates that it may not be a widespread issue.
Fixed for now!
Reporting back for anyone who has this error.
I fixed it by figuring out the fix I mentioned earlier. I eventually ran a database check and found out for whatever reason the table did exist, but was corrupted somehow so that phpMyAdmin wouldn't show it. So it existed but didn't exist at the same time. Go figure.
So I backed up my database, dropped the table and recreated it. Presto it's all fixed. Now the only thing I have to do is make sure the table is correctly set up.
Thanks for the help guys but things seem to be working for now.
Yes, I have the same issue
I have a Drupal Commerce site with this same issue.
I fixed it by running
I fixed it by running
REPAIR TABLE cache_rules;
I wish I could
I wish I could just click REPAIR TABLE for the table. My problem is that the cache_rules table appears in the left column list of tables, but not in right iframe list of tables. Anything I do to try and create a new cache_rules table or view the one displayed in the left column comes up with the "#1146 - Table 'drupal_db.cache_rules' doesn't exist" message.
Edit: I just had to use the SQL query to drop the table, logged out then back in and I was able to recreate the table. Site seems to be working now.
I had the same problems few
I had the same problems few weeks ago. And what I did was to create the table and everything was fixed.
SO, If you have the problem this solution will work.
- Darryl Norris
Be Connected: Website | Twitter | LinkendIn | GitHub
What command did you use
What command did you use to drop that table and recreate it? I'm not that good in phpmyadmin ;)
Thanks
Living life in a grande way.
REPAIR is not working for me.
REPAIR is not working for me.
What works for me is drop the table in SQL and recreate it.
It worked Thanks!
Great been trying to recreate the entire database from a working copy for about 4 times and everytime i clear the cache I keep getting these errors. Sometimes its not only the cache_rules, also happens for cache_fields and to some other tables as well such as comment. I don't know what is happening. I have an acquia devdesktop bundle installed for this and happens all the time.
Thanks again!
Repeating problem
I am frequently experiencing the same issue. It's not only cache_rules but with other cache tables as well. Everytime I clear the cache from the performance tab it gives me: "PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxsite_namexx.cache_rules' doesn't exist:..." I have to always recreate this table all the time. My disk is not full as I have a new laptop purchased with huge free space. I have an Acquia DevDesktop Rc2 install. Either turning off/on options for Bandwidth Optimization does not help. Should this be a bug with Drupal or InnoDB?
=-=
I'd guess it should be researched via Acquia Dev Desktop. If it was something with InnoDB, I'd figure there would be far more reports.
Have the same problem
I'm using Drupal Commerce Kickstart, this situation happened twice on two sites. Looks like some module have a bug cause this one. But hard to find it.
Everyone in this thread
Everyone in this thread should refer to this issue: https://www.drupal.org/node/2160645
Fix the issue table "cache_rules" not exist
Please use the sql query to fix the issue.
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.';
Thanks. Your code worked.
Thanks. Your code worked.
Worked for me as well when I
Worked for me as well when I got this error after my MariaDB server ran out of hard drive space.
Worked for me too.. I missed
Worked for me too.. I missed the "DROP TABLE cache_rules ;" thanks a lot.
Thank you for the code and
Thank you for the code and specific fields of the table! same as @daveparrish, the issue happened when I ran out of space while backing up....
Question
I have a similar message but with I10N_update_file and project.
Is it possible to exproteren the existing table and to change the line of code:
CREATE TABLE `l10n_update_file`
To:
DROP TABLE cache_rules;
CREATE TABLE IF NOT EXISTS `l10n_update_file`
and import the table in the database?
Thanks in advance for thinking.
Hi Peter Nuis - l10n_update
Hi Peter Nuis - l10n_update_file table is different from cache_rules table so I do not think you need to drop the cache_rules table. What is your error exactly? Does it say the l10n_update_file table does not exist when a query is being executed? I would suggest testing on a dev site set-up just to make sure there are no relationships broken and also getting the parameters of the column fields from that table you want to drop because they might not be the same as the cache_rules' parameteres.
Thanks.I worked!!!
Thanks. @aloknarwaria
It worked!!!