Incorrect key file for table错误解决方法

Posted dataart

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Incorrect key file for table错误解决方法相关的知识,希望对你有一定的参考价值。

问题现象:

 

alter table portal_app_xxxx_xxx add devno varchar(64) NOT NULL DEFAULT ‘‘ COMMENT ‘设备机编‘,add serialno varchar(64) NOT
NULL DEFAULT ‘‘ COMMENT ‘绑定流程流水号‘,Error_code: 1034

 mysql error code 1034 (ER_NOT_KEYFILE): Incorrect key file for table ‘XXXXXX‘; try to repair it

 

查找解决方法:

在网上查找了一下,发现大多的解决办法都是repair,然后再进行myisam进行检查及恢复;

但是发现这个方法只适用于存储引擎为MyISAM的表,于是继续猜测着查找方法。

使用repair table时,直接报Innodb表不支持repair方法。

 

猜测解决方法:

由于是对39GB大表进行alter操作,猜想一定会耗用不用临时表,于是检查从库的临时空间为/tmp,仅为总内存的一半,16GB,所以导致了临时表空间不够用,再alter过程中失败了,所以导致修改表结构失败,最终导致主从复制失败。

 

此次的解决方法:

(1) 增加/tmp目录空间;

(2) 修改mysql数据库的tmp目录,把tmp对应的目录迁移到空间更大的地方,然后重启动数据库。

 

| innodb_tmpdir | /data/mysql/mysql3306/data/inno_tmp_dir |  <- 该参数指定alter行为的tmp目录。
| tmpdir | /data/mysql/mysql3306/tmp

 

 

 

 

 







以上是关于Incorrect key file for table错误解决方法的主要内容,如果未能解决你的问题,请参考以下文章

Incorrect key file for table ' '; try to repair it

Incorrect key file for table './xx_db/xx_table.MYI'; try to repair it

Incorrect key file for table '/tmp/#sql_882_0.MYI'; try to repair it

FFmpeg[36] - Could not write header for output file #0 (incorrect codec parameters ?): Invalid

FFmpeg[36] - Could not write header for output file #0 (incorrect codec parameters ?): Invalid

WPA: 4-Way Handshake failed - pre-shared key may be incorrect