I've been seeing the following on a number of sites recently:

$ drush @example.com sql-dump
[...]
Error: Couldn't read status information for table cache_admin_menu ()
mysqldump: Couldn't execute 'show create table `cache_admin_menu`': Table 'examplecom.cache_admin_menu' doesn't exist (1146)

Comments

ergonlogic’s picture

I've never seen this behaviour before:

# mysqlcheck examplecom
[...]
examplecom.cache                                   OK
examplecom.cache_admin_menu
Error    : Table 'examplecom.cache_admin_menu' doesn't exist
status   : Operation failed
examplecom.cache_block                             OK
[...]

Odder still:

mysql> show tables like '%cache%';
+--------------------------------+
| Tables_in_examplecom (%cache%) |
+--------------------------------+
| cache                          |
| cache_admin_menu               |
| cache_block                    |
[...]

mysql> describe cache_admin_menu;
ERROR 1146 (42S02): Table 'examplecom.cache_admin_menu' doesn't exist
ergonlogic’s picture

It looks like this table got corrupted somehow:

# ls -la /var/lib/mysql/examplecom/cache_*
-rw-rw----  1 mysql mysql     8963 Oct 17 12:29 cache_admin_menu.frm
-rw-rw----  1 mysql mysql     8963 Nov 10 01:02 cache_block.frm
-rw-rw----  1 mysql mysql   114688 Nov 13 17:09 cache_block.ibd
-rw-rw----  1 mysql mysql     8963 Nov 10 01:02 cache_bootstrap.frm
-rw-rw----  1 mysql mysql   344064 Nov 13 17:14 cache_bootstrap.ibd
[...]

While cache_admin_menu.frm exists, its corresponding .ibd doesn't. I have no idea how this happened, but that appears to be the only table with this problem. Removing cache_admin_menu.frm was sufficient to get the sqldump working again.

mgifford’s picture

So is this a code problem or just an issue with a corrupt table. If a corrupt table then we can probably close this issue, right?

nerdcore’s picture

Can this be explained by anyone?

mysql> truncate cache_admin_menu;
ERROR 1146 (42S02): Table 'oc2014_t_D7.cache_admin_menu' doesn't exist
mysql> show tables like 'cache_admin%';
+--------------------------------------+
| Tables_in_oc2014_t_D7 (cache_admin%) |
+--------------------------------------+
| cache_admin_menu                     |
+--------------------------------------+
1 row in set (0.00 sec)
nerdcore’s picture

I tried stopping MySQL and removing the files as described in #2. This does indeed allow mysqldump to create a correct dump of the DB, however I am unable to re-enable the admin_menu module:

PDOException: SQLSTATE[42S01]: Base table or view already exists: 1050 Table '"oc2014_t_D7"."cache_admin_menu"' already exists: CREATE TABLE {cache_admin_menu} ( `cid` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.', `data` LONGBLOB NULL DEFAULT NULL COMMENT 'A collection of data to cache.', `expire` INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.', `created` INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry was created.', `serialized` SMALLINT NOT NULL DEFAULT 0 COMMENT 'A flag to indicate whether content is serialized (1) or not (0).', PRIMARY KEY (`cid`), INDEX `expire` (`expire`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Cache table for Administration menu to store client-side...'; Array ( ) in db_create_table() (line 2720 of /data/www/dm7/includes/database/database.inc).

Ace Cooper’s picture

Thank you, had the same problem:

Base table or view not found: 1932 Table 'stockopt2.opt_cache_admin_menu' doesn't exist in engine: SHOW CREATE VIEW `opt_cache_admin_menu`;

#2 helped to solve my problem. After removing opt_cache_admin_menu.frm and restarting MySQL my ability to create backups is available again.

pivica’s picture

Same problem here, last night cpanel backup reported

Dumping MySQL database d7 ..
.. dump failed! Error: Couldn't read status information for table cache_admin_menu ()
mysqldump: Couldn't execute 'show create table `cache_admin_menu`': Table 'd7.cache_admin_menu' doesn't exist (1146)

But just a minute ago when I tried manual dump, mysqlcheck, etc everything is fine.

No idea is this mysql related problem or admin_menu.

ergonlogic’s picture

I just came across this same issue again. Thankfully Google brought me back to this issue, as I hadn't seen it since.

We did experience some mysql issues recently, we suspect from poorly tested Puppet code. But that said, cache_admin_menu was by far the most prevalent table experiencing this issue. The only similar failure was for cache_rules, but an order of magnitude less frequently. However, this difference could simply be due to the popularity of admin_menu on our sites.

masdzen’s picture

disable admin_menu
uninstall admin_menu
i'm search #2 cache_admin_menu.frm file,
stop mysql
remove cache_admin_menu.frm file
start mysql
install admin_menu
get error and press F5 =)

admin_menu work, "drush arb" also work!

Rob C’s picture

Another idea:

mysql -u root -p
USE yourdatabase;
DROP TABLE cache_admin_menu;
CREATE TABLE IF NOT EXISTS cache_admin_menu (
  cid varchar(255) NOT NULL DEFAULT '',
  data longblob,
  expire int(11) NOT NULL DEFAULT '0',
  created int(11) NOT NULL DEFAULT '0',
  serialized smallint(6) NOT NULL DEFAULT '0',
  PRIMARY KEY (cid),
  KEY expire (expire)
);

Related: #2160645: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cache_rules' doesn't exist
Also read: [#2097037]

I'm experiencing this on an old site i'm updating after a transfer to a new host back in January. Figured it had to do with the database dump from the transfer, but that wasn't the case. I am 100% sure this used to work before June 2015. Got a drush ard with all tables from before June, and this site didn't receive any huge changes. And in my case the table didn't exist when i confirmed via mysql. So i'm kinda stunned, because the table is in an archive dump from May. Recreating the table fixed drush, so... to be continued. (mysql server update? or are tables getting to large?)

geresy’s picture

thank you for the snippet Rob C. Tried everything, but this one fixed the errors in about the missing table.

davewilly’s picture

#10 worked for me thanks. I couldn't get SSH access on the host but managed to run the required queries successfully in PHPMyAdmin.

morybel’s picture

Thanks Rob C #10 worked for me after a lot of trial and error.