zoukankan      html  css  js  c++  java
  • 解决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
    
  • 相关阅读:
    剑指offer-整数中1出现的次数
    剑指offer-连续子数组的最大和
    剑指offer-最小的k个数
    剑指offer-数组中超过一半的数字
    剑指offer-二叉搜索树与双向链表
    剑指offer-复杂链表的复制
    剑指offer-二叉树中和为某一值的路径
    剑指offer-二叉搜索树的后序遍历
    Alpha 冲刺 (7/10)
    Alpha 冲刺 (6/10)
  • 原文地址:https://www.cnblogs.com/cuoreqzt/p/3678600.html
Copyright © 2011-2022 走看看