MySQL MyISAM 损坏表,如何恢复?

MySQL MyISAM 损坏表,如何恢复?

我有一个损坏的 MySQL MyISAM 表。它首先在我的 mysql 日志中显示为:

[ERROR] /usr/sbin/mysqld: Table './mydb/mytable' is marked as crashed 
and last (automatic?) repair failed

然后我运行CHECK TABLE了它,经过一个多小时的反复尝试,我得到了这个:

+--------------+-------+----------+----------------------------------------------------------+
| Table        | Op    | Msg_type | Msg_text                                                 |
+--------------+-------+----------+----------------------------------------------------------+
| mydb.mytable | check | warning  | Table is marked as crashed and last repair failed        |
| mydb.mytable | check | warning  | 5 clients are using or haven't closed the table properly |
| mydb.mytable | check | warning  | Size of indexfile is: 215237632      Should be: 4096     |
| mydb.mytable | check | error    | Record-count is not ok; is 4212263   Should be: 0        |
| mydb.mytable | check | warning  | Found 48 deleted space.   Should be 0                    |
| mydb.mytable | check | warning  | Found 1 deleted blocks       Should be: 0                |
| mydb.mytable | check | warning  | Found 8362327 key parts. Should be: 0                    |
| mydb.mytable | check | error    | Corrupt                                                  |
+--------------+-------+----------+----------------------------------------------------------+

所有这些是否都表明该表已经无法挽救?还是应该REPAIR TABLE仍然可以使用?或者是否有其他选项可以修复此表而不替换数据?我首先问这个问题是因为这个表对于我的系统来说非常大,而且我感觉要花很长时间才能知道修复是否有效。

答案1

无论如何,我还是继续做REPAIR TABLE,心想如果桌子已经坏得太厉害了,我也没什么可失去的了。谢天谢地,它成功了!桌子又恢复了,运转正常。

相关内容