zoukankan      html  css  js  c++  java
  • mysqldump:Couldn't execute 'show create table `tablename`': Table tablename' doesn't exist (1146)

    遇到了一个错误mysqldump: Couldn't execute 'show create table `CONCURRENCY_ERRORS`': Table INVOICE_OLD.CONCURRENCY_ERRORS' doesn't exist (1146)

    ###### WARNING ######

    Errors reported during AutoMySQLBackup execution.. Backup failed

    Error log below..

    Error: Couldn't read status information for table CONCURRENCY_ERRORS ()

    mysqldump: Couldn't execute 'show create table `CONCURRENCY_ERRORS`': Table INVOICE_OLD.CONCURRENCY_ERRORS' doesn't exist (1146)

    Error: Couldn't read status information for table CONCURRENCY_ERRORS ()

    mysqldump: Couldn't execute 'show create table `CONCURRENCY_ERRORS`': Table INVOICE_OLD.CONCURRENCY_ERRORS' doesn't exist (1146)

    数据库的版本为: 5.5.22-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

    如下所示,查询不了该表的定义以及数据(都提示该表不存在),但是使用show table like命令又能看到该表。

    mysql> USE INVOICE_OLD;
    Database changed
    mysql> show tables like '%CONCURRENCY_ERRORS%';
    +----------------------------------------------+
    | Tables_in_INVOICE_OLD (%CONCURRENCY_ERRORS%) |
    +----------------------------------------------+
    | CONCURRENCY_ERRORS                           |
    +----------------------------------------------+
    1 row in set (0.73 sec)
     
    mysql> select count(1) from CONCURRENCY_ERRORS;
    ERROR 1146 (42S02): Table 'INVOICE_OLD.CONCURRENCY_ERRORS' doesn't exist
    mysql> desc CONCURRENCY_ERRORS;
    ERROR 1146 (42S02): Table 'INVOICE_OLD.CONCURRENCY_ERRORS' doesn't exist
    mysql> 

    clip_image001

    查看对应表的.frm文件(.frm文件是用来保存每个数据表的元数据(meta)信息,包括表结构的定义等),如下所示,发现该文件是存在的。

    mysql> show variables like '%datadir%';
    +---------------+------------------+
    | Variable_name | Value            |
    +---------------+------------------+
    | datadir       | /u01/mysql/data/ |
    +---------------+------------------+
    1 row in set (0.23 sec)
     
    mysql> exit
    Bye
    -bash-3.2$ cd /u01/mysql/data
    -bash-3.2$ ls CONCURRENCY_ERRORS*
    CONCURRENCY_ERRORS.frm

    Google查了一下资料,发现这个可能是一个bug来的(详情请见链接https://bugs.mysql.com/bug.php?id=65670 ) 因为这个数据库其实早就迁移走,数据库也被我重命名了。检查发现迁移后的数据库里面,该表没有任何数据。于是我尝试从数据库的数据目录删除了CONCURRENCY_ERRORS.frm文件,备份就不会出现这种情况了。但是没有搞清楚这种情况出现的前因后果。

  • 相关阅读:
    编程 判断 是否满足条件 的 验证代码。
    Javascript作用域详解。
    DateTable To Json
    反射_获取字段的Description信息
    C# Json格式
    jQuery选择器
    SQL日期格式转换
    【转载】#pragma once与#ifndef
    C++中的左值与右值
    HTML、CSS基础知识
  • 原文地址:https://www.cnblogs.com/kerrycode/p/4966172.html
Copyright © 2011-2022 走看看