首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在MySQL中创建表,因为“它已经存在”

问无法在MySQL中创建表,因为“它已经存在”
EN

Stack Overflow用户
提问于 2014-03-06 09:54:03
回答 3查看 2.9K关注 0票数 1

关于我的previous question,我的MySQL出了点问题。

我最近需要从MySQL中删除一个表,现在需要在原来的位置创建一个新表。我很难做到这一点,因为正如MySQL工作台所说,“这个表已经存在了。”由于来自MySQL工作台的错误没有什么特别的帮助,下面是我从错误日志中提取的一些内容。有什么问题吗?

我在Windows8.1Pro x64上运行MySQL 5.7。

代码语言:javascript
复制
2014-03-06T01:38:55.459658Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2p_messagedata in the InnoDB data dictionary has tablespace id 25, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
2014-03-06T01:38:55.464671Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2p_onlineusers in the InnoDB data dictionary has tablespace id 26, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
InnoDB: Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html
InnoDB: for how to resolve the issue.
2014-03-06T01:38:55.468672Z 0 [ERROR] InnoDB: Table thepwf_prgminteractions/p2pchat_betaaccesskeys in the InnoDB data dictionary has tablespace id 24, but tablespace with that id or name does not exist. Have you deleted or moved .ibd files? This may also be a table created with CREATE TEMPORARY TABLE whose .ibd and .frm files MySQL automatically removed, but the table still exists in the InnoDB internal data dictionary.
EN

回答 3

Stack Overflow用户

发布于 2014-03-06 09:59:11

如果表存在,则只需使用drop table (http://dev.mysql.com/doc/refman/5.6/en/drop-table.html)将其删除

即

代码语言:javascript
复制
drop table <table name>

你一定做错了什么,因为表仍然存在。

可以使用select进行检查

即

代码语言:javascript
复制
select * from <table name>
票数 1
EN

Stack Overflow用户

发布于 2014-03-06 10:46:22

看起来您的innodb表空间已损坏。

从percona查看这篇文章

http://www.mysqlperformanceblog.com/2008/07/04/recovering-innodb-table-corruption/

这些工具

http://www.percona.com/software/percona-toolkit

他们会救你的!

我不知道它们在windows上运行得有多好,但这些工具的功能应该是一样的。

票数 1
EN

Stack Overflow用户

发布于 2015-07-09 23:50:27

转到mysql文件夹的安装位置: C:\Apps\mysql-5.6.25-win64\data\databasename

在databasename下,您可以找到您的表名。手动删除此表,然后使用SQL create table命令重新创建它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22213292

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档