本文来自:

https://www.cnblogs.com/zjoch/archive/2013/08/19/3267131.html

今天mysql突然出现以下错误:

mysql> select * from test;
 ERROR 1034 (HY000): Incorrect key file for table ‘test’; try to repair it

首先通过repair table修复:

mysql> repair table test;
 +—————+——–+———-+———————————————————+
 | Table         | Op     | Msg_type | Msg_text                                                |
 +—————+——–+———-+———————————————————+
 | test.test | repair | Error    | Incorrect key file for table ‘test’; try to repair it |
 | test.test | repair | error    | Corrupt 
 
如果还是没用,运行下面命令

mysql> repair table test USE_FRM;
 +—————+——–+———-+———————————————————+
 | Table         | Op     | Msg_type | Msg_text                                                |
 +—————+——–+———-+———————————————————+
 | test.test | repair | Error    |Number of rows changed from 0 to 110423 |
 | test.test | repair | status   | OK

按理应该可以了。
如果还是没用,则退出mysql,执行如下修复动作:

myisamchk -of /var/lib/mysql/test/test.MYI
 myisamchk -r /var/lib/mysql/test/test.MYI
 myisamchk safe-recover /var/lib/mysql/test/test.MYI

再重启mysql后应该可以正常了。

mysql出现“Incorrect key file for table”解决办法的更多相关文章

  1. Incorrect key file for table错误解决方法

    问题现象: alter table portal_app_xxxx_xxx add devno varchar(64) NOT NULL DEFAULT '' COMMENT '设备机编',add s ...

  2. MySQL表损坏修复【Incorrect key file for table】

    今天机房mysql服务器异常关机,重新启动后报错如下: -- :: [ERROR] /usr/local/mysql/bin/mysqld: Incorrect key file for table ...

  3. mysql中大数据表alter增加字段报错:"1034 Incorrect key file for table 'table_name'; try to repair it"

    mysql中大数据表alter增加字段报错:"1034 Incorrect key file for table 'table_name'; try to repair it" 现 ...

  4. mysql错误(Incorrect key file for table)

    Incorrect key file for table 'C:\Windows\TEMP\#sql578_6e2_68d.MYI'; try to repair it mysql错误:mysql需要 ...

  5. java.sql.SQLException: Incorrect key file for table 'C:\Windows\TEMP\#sql578_6e2_68d.MYI'; try to repair it

    java.sql.SQLException: Incorrect key file for table 'C:\Windows\TEMP\#sql578_6e2_68d.MYI'; try to re ...

  6. mysqld: Incorrect key file for table

    错误 140624 0:53:42 [ERROR] /usr/libexec/mysqld: Incorrect key file for table './xx/xxx.MYI'; try to r ...

  7. MyISAM引擎表出现“Error 'Incorrect key file for table”

    mysql主从复制中的从库突然出现了警报,sql_thread停止了,show slave status\G;查看 mysql> show slave status\G ; . row **** ...

  8. 数据表损坏:Incorrect key file for table

    最近做项目过程中,调用数据库内容,老是出现一些类似于数据表损坏的提示信息(Incorrect key file for table edison_category),查询不到数据,很是恼火,后来冷静下 ...

  9. 执行查询报: Incorrect key file for table ‘test’; try to repair it

    报错信息如下:程序没有错误,但执行会报错,错误定在执行语句上 查了一下资料 网上的解决办法,亲试可用: mysql> use news;Database changedmysql> rep ...

随机推荐

  1. Xorboot-UEFI新手入门教程

    Xorboot-UEFI新手入门教程        Xorboot-UEFI是一款UEFI下轻量级的图形化多系统引导程序,pauly于2014年国庆节期间发布了预览版.搜了下论坛,关于Xorboot- ...

  2. python 代理的使用

    这里分享一个测试ip的网址     http://ip.filefab.com/index.php scrapy 随机请求头和代理ip的使用原理 import random # 添加一个中间键 cla ...

  3. apache2.4+php7.3.2+mysql5.7

    一.下载php7和apache2.4 1 首先下载php7的windows压缩包,到这里下载http://windows.php.net/download/ 我选择的是php7的这个版本,由于它是vc ...

  4. 如何限制指定textFiled第三方输入法切换

    在有些项目中需要用到输入纯数字的键盘,并且还不能切换到第三方输入法! textFiled.secureTextEntry = YES; [textFiled addTarget:self action ...

  5. windows环境下ElasticSearch6 安装head插件

    转: https://blog.csdn.net/shubingzhuoxue/article/details/80998738 https://blog.csdn.net/camelcanoe/ar ...

  6. idea git commit撤销

    到项目目录下,打开git bash 1.git log 找到要撤销的版本id1 commit之前的版本id2 2.git reset –hard id13.git reset id2 参考链接:htt ...

  7. robotframework在3.7下的搭建

    网上看了大多安装RIDE都是在python2的环境下,今天试了下python3的安装,成功了,步骤如下: 1.首先是python3的安装,以及pip这些工具,具体的网上一堆,不再啰嗦 2.安装robo ...

  8. Centos 7.5下搭建SVN源代码服务器

    1.先查看是否存在svn,没有就需要安装svn svnserve --version #查看svn版本号 which svn #查看svn程序所在目录 yum install subversion - ...

  9. 0008 合并K个排序链表

    合并 k 个排序链表,返回合并后的排序链表.请分析和描述算法的复杂度. 示例: 输入: [   1->4->5,   1->3->4,   2->6 ] 输出: 1-&g ...

  10. flask同源策略解决办法及flask-cors只允许特定域名跨域

    falsk 同源策略解决办法: 使用 flask-cors 包 并且 在代码里 加响应的一行代码解决. from flask import Flask, session from flask_cors ...