ERROR 1194 (HY000): Table 't1' is marked as crashed and should be repaired

今天测试mysql,发现一个表出现了以下报错

ERROR 1194 (HY000): Table 't1' is marked as crashed and should be repaired


在网上搜有些说需要通下面方法进行修复

[root@localhost data]# myisamchk -f ./test2/*.MYI
Checking MyISAM file: ./test2/t1.MYI
Data records:   24926   Deleted blocks:       0
- check file-size
myisamchk: error: Size of datafile is: 73                Should be: 174482
- recovering (with keycache) MyISAM-table './test2/t1.MYI'
Data records: 24926
Data records: 5


---------


Checking MyISAM file: ./test2/t2.MYI
Data records:  482688   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check record links
          
---------


Checking MyISAM file: ./test2/t4.MYI
Data records:  482688   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference


---------


Checking MyISAM file: ./test2/t5.MYI
Data records:  482688   Deleted blocks:       0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check record links


然后在mysql 里使用repair中进行修复,成功。


mysql> repair table cmxt.cm_user_pref;

+-------------------+--------+----------+----------+

| Table             | Op     | Msg_type | Msg_text |

+-------------------+--------+----------+----------+

| cmxt.cm_user_pref | repair | status   | OK       |

+-------------------+--------+----------+----------+

后来经过实验发现

首先检查check table t1

mysql> check table t1;
+----------+-------+----------+---------------------------------------------------+
| Table    | Op    | Msg_type | Msg_text                                          |
+----------+-------+----------+---------------------------------------------------+
| test2.t1 | check | error    | Size of datafile is: 73         Should be: 174482 |
| test2.t1 | check | error    | Corrupt                                           |
+----------+-------+----------+---------------------------------------------------+
2 rows in set (0.00 sec)


然后再使用myisamchk来修复

[root@localhost mysql]# myisamchk -f ./data/test2/t1.MYI
Checking MyISAM file: ./data/test2/t1.MYI
Data records:   24926   Deleted blocks:       0
myisamchk: warning: Table is marked as crashed
- check file-size
myisamchk: error: Size of datafile is: 73                Should be: 174482
- recovering (with keycache) MyISAM-table './data/test2/t1.MYI'
Data records: 24926
Data records: 5


然后再查看t1表

mysql> select * from t1;
+-------------+
| str_number  |
+-------------+
|        NULL |
|        NULL |
| -1774844896 |
|        NULL |
|        NULL |
+-------------+
5 rows in set (0.00 sec)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值