Take the 2-minute tour ×

the goal is simple, but rather unusual. I wrote a database auto-repair script (as one of the tables keeps crashing from time to time, probably due to very large amounts being inserted and deleted constantly), and I want to test it. The problem is, that I need to crash a table on purpose, and I have no idea how. Any suggestions?

share|improve this question
does it go something like this: ALTER TABLE <tabname> ENGINE=InnoDB; ? –  f00 Feb 28 '11 at 9:28
Does what go like that? –  cypher Feb 28 '11 at 9:29
your repair script –  f00 Feb 28 '11 at 10:12
Write some time consuming UPDATE SQL and press reset button. –  Tony Feb 28 '11 at 10:18

2 Answers 2

up vote 3 down vote accepted

You can certainly make a MyISAM table look crashed by truncating the .MYI file to 4k (Assuming it was bigger than 4k). Then do a FLUSH TABLE, followed by a query which needs to use an index.

If the tables are crashing spontaneously, then either

  • There is a bug in the server OR
  • Something bad is happening - either someone kill -9 the server, it crashes, the power fails, or someone is modifying the MyISAM files

MyISAM tables should not crash spontaneously, but you can expect them to crash following an unclean shutdown. Unclean shutdowns should not happen very often, if they are, it is an operational problem. Ask your operations engineers what's going on. It is normally clear what's happened from reviewing the mysql server error log.

share|improve this answer
Thank you, kill -9 did the trick. –  cypher Feb 28 '11 at 15:34

In MyIsam, run OPTIMIZE TABLE and kill it while it runs. The table will be marked as crashed.

share|improve this answer

Your Answer


