• 解决mysqldump 出现Incorrect key file for xxx; try to repair it


    > I'm trying to do a recover on a table for a client, with the following message
    >
    > root@falcon:~# mysqldump -u root -pXXXXXXX database
    > -- MySQL dump 10.13  Distrib 5.1.30, for pc-linux-gnu (i686)
    > --
    > -- Host: localhost    Database: database
    > -- ------------------------------------------------------
    > -- Server version       5.1.30
    >
    > /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    > /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    > /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    > /*!40101 SET NAMES utf8 */;
    > /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    > /*!40103 SET TIME_ZONE='+00:00' */;
    > /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    > /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    > /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    > /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
    > mysqldump: Got error: 1034: Incorrect key file for table 'table1'; try to repair it
    > when using LOCK TABLES
    > root@falcon:~#
    >
    > I'm trying recover with
    >
    > mysql> check table table1;
    >
    > +-----------------+-------+----------+-----------------------------------------------------------+
    > | Table           |
    > Op    | Msg_type |
    > Msg_text                                                 
    > |
    >
    > +-----------------+-------+----------+-----------------------------------------------------------+
    > | database.table1 | check | Error    | Incorrect key file for table
    > 'table1'; try to repair it |
    > | database.table1 | check | error    |
    > Corrupt                                                  
    > |
    >
    > +-----------------+-------+----------+-----------------------------------------------------------+
    > 2 rows in set (0.00 sec)
    >
    > mysql> repair table table1;
    >
    > +-----------------+--------+----------+-----------------------------------------------------------+
    > | Table           |
    > Op     | Msg_type |
    > Msg_text                                                 
    > |
    >
    > +-----------------+--------+----------+-----------------------------------------------------------+
    > | database.table1 | repair | Error    | Incorrect key file for table
    > 'table1'; try to repair it |
    > | database.table1 | repair | error    |
    > Corrupt                                                  
    > |
    >
    > +-----------------+--------+----------+-----------------------------------------------------------+
    > 2 rows in set (0.00 sec)
    >
    > mysql> lock table table1 write;
    > ERROR 1034 (HY000): Incorrect key file for table 'table1'; try to repair it
    > mysql>
    >
    >
    > Trying repair with myisamchk and mysqlcheck
    >
    > root@Falcon:~# mysqlcheck -r database table1 -u root -pXXXX database.table1
    > Error    : Incorrect key file for table 'table1'; try to repair it
    > error    : Corrupt
    > root@falcon:~#
    >
    > root@Falcon:~# cd /data/mysql/database
    > root@Falcon:/data/mysql/database# myisamchk -r *.MYI
    > - recovering (with sort) MyISAM-table 'table1.MYI'
    > Data records: 0
    > - Fixing index 1
    >
    > ---------
    >
    > Any idea.
    
    Try to start with MySQL advices for such cases:
    http://dev.mysql.com/doc/refman/5.6/en/myisam-repair.html
    
  • 相关阅读:
    基础GIT命令
    初始继承和多态。
    Servlet随笔
    初识springboot
    HBase JavaAPI
    HBase安装
    使用Eclipse来操作HDFS的文件
    hadoop常用命令
    Eclipse集成Hadoop插件
    Hadoop集群测试wordcount程序
  • 原文地址:https://www.cnblogs.com/cuoreqzt/p/3678600.html
Copyright © 2020-2023  润新知