ITPub博客

首页 > 数据库 > MySQL > Table already exists error when the table does not exist

Table already exists error when the table does not exist

原创 MySQL 作者:goolen 时间:2014-05-08 16:05:55 0 删除 编辑
今天在一套mysql的库里发现一个问题,要创建一个表的时候,提示这个表已经存在,要drop的时候,提示此表不存在
mysql> CREATE TABLE cms_attach_source (id int);  
ERROR 1050 (42S01): Table '`koo_cms`.`cms_attach_source`' already exists

mysql> drop table CMS_ATTACH_SOURCE;
ERROR 1051 (42S02): Unknown table 'CMS_ATTACH_SOURCE'

mysql> drop table cms_attach_source;
ERROR 1051 (42S02): Unknown table 'cms_attach_source'

mysql> show tables like '%source%';
+------------------------------+
| Tables_in_koo_cms (%source%) |
+------------------------------+
| v9_dbsource                  |
+------------------------------+
1 row in set (0.00 sec)

直接去操作系统上查看一下,发现只有ibd文件存在
[root@php-neibu-18 koo_cms]# ls cms_attach_source* -l        
-rw-rw---- 1 root root 17825792 May  8 07:45 cms_attach_source.ibd

.frm文件丢失了,因为这个表是从外网同步回来的,我直接把外网的.frm文件拷贝回来,改了权限,就ok了

[root@php-neibu-18 koo_cms]# ls cms_attach_source* -l
-rw-rw---- 1 root root     8986 Jun 24  2013 cms_attach_source.frm
-rw-rw---- 1 root root 17825792 May  8 07:45 cms_attach_source.ibd

[root@php-neibu-18 koo_cms]# chown mysql:mysql cms_attach_source.*   

mysql> drop table cms_attach_source;
Query OK, 0 rows affected (0.00 sec)


mysql> create table cms_attach_source(id int);
Query OK, 0 rows affected (0.00 sec)

这里多谢吴炳锡吴总的指导。。。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23249684/viewspace-1156832/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-10-20

  • 博文量
    121
  • 访问量
    731655