Questions

Forum Navigation
Please to create posts and topics.

mySQL - Error 1034 - "Index for table 'db' is corrupt; try to repair it"

I an encountering the error in subject. How to fix it?

I was just updating user's privileges, but after doing such changes I am not more able to access this specific user privileges.

Occasionally, MySQL tables can become corrupted, meaning that an error has occurred and the data held within them is unreadable. Attempts to read from a corrupted table will usually lead to the server crashing.

Some common causes of corrupted tables are:

  • The MySQL server stops in middle of a write.
  • An external program modifies a table that’s simultaneously being modified by the server.
  • The machine is shut down unexpectedly.
  • The computer hardware fails.
  • There’s a software bug somewhere in the MySQL code.

In phpMyAdmin, or by using mysql command line, you can issue the following two simple queries to check and fix the corrupted table (if possible):

CHECK TABLE table_name;

A message will appear in this statement’s output letting you know whether or not it’s corrupted. If the MyISAM table is indeed corrupted, it can usually be repaired by issuing a REPAIR TABLE statement:

REPAIR TABLE table_name;

Assuming the repair was successful, you will see a message like the following in your output:

mySQL - Error 1034 - "Index for table 'db' is corrupt; try to repair it"