mysql: "tablename" is marked as crashed and should be repaired修复 问题分析: 当mysql出现这类提示时,大部分的现象为查询不到正常的
2017-07-19 16:44
886 查看
问题分析:
当mysql出现这类提示时,大部分的现象为查询不到正常的表记录,或者只能查询到部分。主要的原因是对应表的索引文件被损坏,导致索引文件损坏的可能原因有:
频繁的读写表记录
数据库服务器非正常关闭,比如:断电
问题修复:
好在mysql提供了索引文件的修复工具,通过修复功能一般都可以使数据修复正常。修复工具之前搜索有2个:
myisamchk -c -r -f /path/to/tablename.MYI使用这个命令需要先查找到对应表的索引文件,即*.MYI文件【mysql index的缩写】
这个文件是存储在mysql的data目录下,而这个data目录因mysql的版本不同,存放位置也不一样。甚至不同类型的操作系统存放的都不在一个位置。通常mysql的data目录会在这几个路径:
%PROGRAMDATA%\MySQL\MySQL Server 5.6\ [mysql 5.6.8+, win7] %WINDIR%\ INSTALLDIR\ [mysql 5.6.8-] %APPDATA%\MySQL\ [mysql 5.6.8+, windows 2003]
mysqlcheck -u root -p dbname --auto-repair使用这个命令就不在需要查找MYI文件的路径了,它会根据提供的数据库名,自动的遍历全部数据表。最后针对需要修复的表进行修复。
本次成功恢复数据使用的就是第二种方法【windows server 2003 + mysql 5.6.28】,修复结果如下图
数据备份:
当然了,除了出现问题是需要找方法修复;其实最重要的还是平时定期的备份数据库。这样即使哪天数据库都没了,我们还是依然能够恢复数据的。数据库备份命令:
mysqldump -u root -p dbname > dbname.sql
相关文章推荐
- Mysql 出现 Table ‘xxx’ is marked as crashed and should be repaired 问题
- mysql表修复问题---(table is marked as crashed and should be repaired)
- Mac的mysql出现Table 'AAA' is marked as crashed and should be repaired
- 解决MySQL"is marked as crashed and should be repaired"问题
- mysql 数据库程序出现Table xxx is marked as crashed and should be repaired
- 解决:"MySQL error code 145 Table was marked as crashed and should be repaired"的问题
- 出现Table ‘./mysql/proc’ is marked as crashed and should be repaired
- 解决 MySQL 的 Table is marked as crashed and should be repaired 问题
- mysql 出现表损坏解决方法:table 'xxx' is marked as crashed and should be repaired
- linux 服务器mysql出现is marked as crashed and should be repaired解决办法
- 快速解决"****table is marked as crashed and should be repaired"故障
- mysql Table 'XXX' is marked as crashed and should be repaired
- mysql错误:Table XXX is marked as crashed and should be repaired
- mysql:Table './xdb/auditlog' is marked as crashed and should be repaired
- Table 'this_' is marked as crashed and should be repaired (MYSQL数据错误解决)
- Table 'table_name' is marked as crashed and should be repaired
- MySQL:Table XXX is marked as crashed and should be repaired
- 解决数据库 Table 'content_tags' is marked as crashed and should be repaired 表损坏问题
- Mysql错误:Table 'xxx'is marked as crashed and should be repaired
- mysql:Table 'xxxxx' is marked as crashed and should be repaired