如何修复MySQL的“错误密钥文件"?无法修复表时出错? [英] How do you fix a MySQL "Incorrect key file" error when you can't repair the table?

查看:90
本文介绍了如何修复MySQL的“错误密钥文件"?无法修复表时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个相当大的查询,该查询应该每晚运行以填充一个表.我收到错误消息说Incorrect key file for table '/var/tmp/#sql_201e_0.MYI'; try to repair it,但是我正在使用的存储引擎(我猜默认是什么?)不支持修复表.

如何解决此问题,以便我可以运行查询?

解决方案

存储引擎(MyISAM)支持修复表.您应该能够修复它.

如果修复失败,则表明该表已损坏,您别无选择,只能从备份中还原它.

如果您的其他系统(例如,具有相同软件版本和架构的非生产系统)具有相同的表,则可以通过一些黑客(将frm复制为MYI文件,然后进行修复)进行修复. /p>

从本质上讲,诀窍是避免一开始就弄坏表.这意味着始终干净地关闭数据库,永远不会崩溃,永远不会出现硬件或电​​源问题.实际上,这不太可能,因此,如果耐用性很重要,那么您可能要考虑使用更具碰撞安全性的存储引擎.

I'm trying to run a rather large query that is supposed to run nightly to populate a table. I'm getting an error saying Incorrect key file for table '/var/tmp/#sql_201e_0.MYI'; try to repair it but the storage engine I'm using (whatever the default is, I guess?) doesn't support repairing tables.

how do I fix this so I can run the query?

解决方案

The storage engine (MyISAM) DOES support repair table. You should be able to repair it.

If the repair fails then it's a sign that the table is very corrupted, you have no choice but to restore it from backups.

If you have other systems (e.g. non-production with same software versions and schema) with an identical table then you might be able to fix it with some hackery (copying the frm an MYI files, followed by a repair).

In essence, the trick is to avoid getting broken tables in the first place. This means always shutting your db down cleanly, never having it crash and never having hardware or power problems. In practice this isn't very likely, so if durability matters you may want to consider a more crash-safe storage engine.

这篇关于如何修复MySQL的“错误密钥文件"?无法修复表时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆