Tuesday, March 2, 2010

Resolving MySQL Error: 'Found wrong record at 0'

MySQL database tables can become inconsistent when a write operation to a data file doesn't accomplish successfully. This could occur due to several reasons like non-graceful shutdown of the server or power failure. Another reasons include application bugs, storage engine issues and more. The application provides myisamchk and mysqlcheck as two tools that can detect and repair such corruption errors in MySQL tables. If they fail to do so, you will require a valid backup to restore the lost information. However, if backup too fails to give the required results, you need to use MySQL Database Recovery application to repair the corrupted database.


For an instance, when you run myisamchk to check the consistency of a MySQL database table, it might report you errors as below:

“myisamchk: error: Found wrong record at 0
MyISAM-table 'table_name.MYI' is corrupted”

Where, table_name.MYI refers to the name of the table. MySQL uses .MYI files to use index information of the database table.

Cause

The above error is generally encountered when the .MYI file is inconsistent due to corruption.

Solution

To troubleshoot the database table corruption errors and to restore the information, you should apply these methods:

If you suspect that database table is corrupted, execute myisamchk command. Before running the command, you need to ensure that your MySQL server is not running. Follow this syntax to repair:

myisamchk --recover table_name.MYI

If the issue persists, try restoring from your backup. In order for backup to give complete results, it should exist in clean and completely updated state.
If none of the above measures help or is feasible, delete the damaged database table and create a new one.

To prevent data loss, you can alternatively repair your database using MySQL Recovery tools. Such MySQL Database Recovery utilies employ effective scanning algorithms to repair and restore the data stored in MyISAM tables. With exceptionally realistic user interface, this repair utility is easily usable without sound technical understanding. The repair tools should also set a secure link with MySQL Server while repairing the corrupted MyISAM table.

Stellar Phoenix Database Recovery for MySQL is the most used MySQL Repair software. This non-destructive repair utility is compatible with both (MyISAM and InnoDB) MySQL database storage engines. It can completely restore and Repair MySQL components like tables, primary key(s) and relations. It supports MySQL Recovery from MySQL database installed Windows (Vista, XP, 2003 and 2000) and on Linux platform.

Article Source :- http://www.articledashboard.com/Article/Resolving-MySQL-Error---Found-wrong-record-at-0-/1054308

No comments:

Post a Comment