Language
      English flagItalian flagKorean flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flag
      Arabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flag
      Finnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flag
      Hebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flag
      Vietnamese flagAlbanian flagEstonian flagGalician flagMaltese flagThai flagTurkish flagHungarian flag
    Tag Cloud
    Recent Comments
    Sponsors
      Articles Archive
      Link with us

      IT Solutions Knowledge Base

      Stats
      Visits today: 49
      Visits total: 54715
      Online visits: 0
Repairing corrupted MySQL databases
Home » Linux, WHM/Cpanel » Repairing corrupted MySQL databases
By Glafkos Charalambous | No CommentsLeave a Comment
Last updated: Sunday, November 30, 2008

Repairing corrupted mysql databases when they get corrupted can happen in many situations. When your databases get corrupted there are plenty of tools available to repair them.

In most cases only the index gets corrupted and not the actual data which is very rare to happen.

In this article we will demostrate myisamchk tool to repair some corrupted mysql databases as well mysqlcheck and repair table command.

Locate mysql databases:

cd /var/lib/mysql

myisamchk Utility (MyISAM Only)
Description: myisamchk can check and repair MyISAM tables

Running the repair command for all database tables:

myisamchk -q -r -f -s  *.MYI

Running the repair command for specific table:

myisamchk -q -r -f -s  table.MYI

Options used:

Change the collation used by the index.
-q, –quick        Faster repair by not modifying the data file. One can give a second ‘-q’ to force myisamchk to modify the original datafile in case of duplicate keys.
NOTE: Tables where the data file is corrupted can’t be fixed with this option.

-r, –recover      Can fix almost anything except unique keys that aren’t unique.

-f, –force         Overwrite old temporary files.

-s, –silent        Only print errors.  One can use two -s to make myisamchk very silent.

Other database repair tools:

REPAIR Table SQL Statement (MyISAM Only)

Usage:

mysql> REPAIR TABLE tablename;

In case the indexing file is missing or is corrupted u can use the USE_FRM option.

mysql> REPAIR TABLE tablename USE_FRM;

mysqlcheck Utility (MyISAM Only)

Usage:

mysqlcheck -r database table -uuser -ppass

VN:F [1.4.6_730]
Rating: 0.0/10 (0 votes cast)
  • Digg
  • Facebook
  • Technorati
  • del.icio.us
  • StumbleUpon
  • Sphinn
  • Reddit
  • Google Bookmarks
  • Wikio IT
  • Slashdot
  • co.mments
  • Fark
  • Fleck
  • LinkedIn
  • Ma.gnolia
  • MisterWong
  • MySpace
  • Propeller
  • Print this article!
  • E-mail this story to a friend!

Comments

There are no comments just yet

Leave a Comment

Add your picture!
Join Gravatar and upload your avatar. C'mon, it's free!