1、故障现象

mysql> select count(*) from dede_archives;
ERROR 144 (HY000): Table '.xx' is marked as crashed and last (automatic?) repair failed

2、故障原因

Mysqld进程在数据写入时被意外关闭

意外关闭计算机

硬件故障

3、mysql官方解决方案

官方文档:https://dev.mysql.com/doc/refman/5.6/en/myisam-table-maintenance.html

3.1 check table  检查表的完整性

mysql> check table xx FAST  QUICK; /*快速检查表*/

或者

mysql> check table xx EXTENDED; /*全表检查,耗时长*/

正常输出:

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

| Table                 | Op    | Msg_type | Msg_text |

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

| xx                    | check |
status   | OK       |

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

1 row in set (0.16 sec)

3.2 REPAIR TABLE  修复表 适用于MyISAM

mysql> REPAIR TABLE xx;

正常输出:

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

| Table                   | Op     | Msg_type | Msg_text |

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

| xxxx                    | repair | status   | OK      
|

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

1 row in set (0.24 sec)

3.3 myisamchk 快速修复表(恢复模式,并重建索引文件)

C:\>myisamchk -r xx

输出:

- recovering (with sort) MyISAM-table
'xx'

Data records: 11543

- Fixing index 1

- Fixing index 2

- Fixing index 3

- Fixing index 4

备注:3.2和3.3任选一个进行修复

      在进行检查和修复表之前,需要对表和数据库进行备份

MyISAM表维护也可以使用SQL语句完成,该语句执行与myisamchk可以执行的操作类似的 操作:

3.4 迁移数据库(如果由于底层存储损坏导致的表故障)

    使用mysqldump进行备份恢复

扩展

mysql错误代码查询

shell> perror 126 127 132 134 135 136 141 144 145
MySQL error code 126 = Index file is crashed
MySQL error code 127 = Record-file is crashed
MySQL error code 132 = Old database file
MySQL error code 134 = Record was already deleted (or record file crashed)
MySQL error code 135 = No more room in record file
MySQL error code 136 = No more room in index file
MySQL error code 141 = Duplicate unique key or constraint on write or update
MySQL error code 144 = Table is crashed and last repair failed
MySQL error code 145 = Table was marked as crashed and should be repaired

最新文章

  1. React-Native坑:Invariant Violation:Application 项目名 has not been registered.
  2. CabArc to create or extract a cab file
  3. [deviceone开发]-do_Dialog的基本使用示例
  4. 第一篇随笔!!!THE FIRST BLOOD!!!
  5. 多态、类库、委托、is和as运算符、泛型集合
  6. juniper 550M訪问自身公网IP回流内部IP
  7. mysqli_stmt预处理类
  8. JVM系列一:JVM内存组成及分配
  9. (高精度运算4.7.26)POJ 1220 NUMBER BASE CONVERSION(高精度数的任意进制的转换——方法:ba1----->10进制----->ba2)
  10. MySQL5日期类型DATETIME和TIMESTAMP相关问题详解
  11. IE浏览器div错乱问题
  12. 我的Android进阶之旅------>Android 设置默认语言、默认时区
  13. Spring @Transactional使用的示例
  14. 【爆料】-《布莱顿大学毕业证书》Brighton一模一样原件
  15. Sharepoint 2013搜索服务配置总结(实战)
  16. 浏览收藏夹 看到了hadoop3.0 的改动
  17. Unity3D学习笔记(三十四):Shader着色器(1)
  18. 微软BI 之SSAS 系列 - 实现Cube 以及角色扮演维度,度量值格式化和计算成员的创建
  19. Mac OS X 下多个JDK版本的切换小技巧
  20. jdbc(1)(三)DBCP、C3P0、Proxool 、 BoneCP开源连接池的简介

热门文章

  1. Python爬虫之requests库的使用
  2. XCTF-mfw
  3. 【python】Leetcode每日一题-132模式
  4. Day003 变量、常量、作用域
  5. Elasticsearch exception [type=mapper_parsing_exception, reason=No type specified for field [X]
  6. If-Else 太多,如何优化!!!
  7. Vim安装记录
  8. 011.Ansible条件语句
  9. 备份分区,备份文件切割保存 dd
  10. 新晋总监生存指南三——OKR