How can I force a MySQL table to become corrupted?

Generally you can't back up the databases by copying them from /var/lib/mysql and then copying them back because they get corrupted, you have to use mysqldump instead.

So if you go into one of the folders for the database in /var/lib/mysql, ie /var/lib/mysql/myDB/ and mess with some of the files that ought to do it :-)

So I would recommend copying one of the files, editing a little with a hex editor, and copying it back.


cat DB1.myd /dev/random > DB2.myd

You could use a fuzzing tool like zzuf to fuzz a preexisting database file, e.g.

zzuf < good.myd > fuzzed.myd