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
    
  • 相关阅读:
    C++中字符串与字符串函数的使用
    面试题17:打印从1到最大的n位数
    动态规划:0-1背包
    POJ 2386 Lake Counting (简单深搜)
    HDU 2612 Find a way 简单广搜
    POJ 3669 Meteor Shower (BFS+预处理)
    深搜(DFS)广搜(BFS)详解
    HDU6055 Regular polygon(计算几何)
    hdu 6047 Maximum Sequence 贪心
    hdu 6045 Is Derek lying?(思维推导)
  • 原文地址:https://www.cnblogs.com/cuoreqzt/p/3678600.html
Copyright © 2011-2022 走看看