删除崩溃的 Innodb 表
我无法删除/删除崩溃的 Innodb 表。我收到以下错误:
ERROR 1051 (42S02): Unknown table 'accounts'
如果我想创建它,我收到以下错误:
ERROR 1005 (HY000): Can't create table 'accounts' (errno: -1)
我的服务器在意外断电后会发生这种情况。
问候
I cannot delete/drop a crashed Innodb table. I get the following error:
ERROR 1051 (42S02): Unknown table ‘accounts’
And if I want to create it I get the following error:
ERROR 1005 (HY000): Can’t create table ‘accounts’ (errno: -1)
This happens on my server after an accidental power failure.
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在这里也发现了这个问题 http://www.randombugs.com/linux/crash -innodb-table.html 似乎只需删除 ibdata 文件并重新启动 mysql 就可以解决这个问题。无论如何,如果您没有任何备份,这并不是真正的解决方案。
I also found this problem here http://www.randombugs.com/linux/crash-innodb-table.html and it seems just deleting ibdata file and restarting mysql can solve this. Anyway this is not truly a solution if you don't have any backup.
在删除表之前关闭外键约束有帮助吗?
有一个错误报告详细介绍了类似的内容,但我不清楚是否是同一问题:
http://bugs.mysql.com/bug.php?id=5784
如果没有,你可以尝试 mysqlcheck:
您必须检查文档以找到最适合您的数据库的选项。请务必注意文档第一段中有关此命令运行时放置在表上的锁的注释。
Does turning off foreign key constraints prior to dropping the table help?
There is a bug report which details something similar, but I'm not clear if it is the same issue:
http://bugs.mysql.com/bug.php?id=5784
If not, you could try mysqlcheck:
You'll have to check the docs for the most appropriate options for your database. Be sure to note the comments in the first paragraph of the docs about the locks that are placed on tables while this command is running.
我的猜测是 InnoDB 甚至没有加载(检查 SHOW ENGINES),因此在您首先解决该问题之前您将无法删除它。
通常你可以在恢复模式3下启动InnoDB,删除你需要的任何内容,然后关闭并删除恢复模式设置:
http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
My guess is that InnoDB isn't even loaded (check SHOW ENGINES), so you're not going to be able to DROP it until you fix that problem first.
Usually you can start InnoDB up in recovery mode 3, drop whatever you need, and then shutdown and remove the recovery mode setting:
http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html
对我有用的简单解决方案。
尝试删除该表。
删除表tableOne;
您将看到错误:
从另一个数据库复制该表的创建语句或写入它。
创建表
tableOne
(ID
int(11) NOT NULL,LOCKED
tinyint(1) NOT NULL) ENGINE=InnoDB;成功
删除表格
成功
Simple solution that worked for me.
Try to delete the table.
drop table tableOne;
You will see error:
Copy the create statement of that table from another Database or write it.
CREATE TABLE
tableOne
(ID
int(11) NOT NULL,LOCKED
tinyint(1) NOT NULL) ENGINE=InnoDB;Successful
Drop the table
Successful