Dave Perrett

MySQL Table 'Is Marked as Crashed'

database, linux, programming, quickie

I recently had a problem trying to use mysqldump where it was complaining that

1
mysqldump: Got error: 145: Table './recurser/wp_options' is marked as crashed and should be repaired when using LOCK TABLES

This corrupted wp_options table actually caused wordpress to think it was a fresh install, and showed the interface to create the admin user to anyone who accessed recurser which is a little scary :)

The solution was to go to the actual database directory, and run myisamchk -r on the offending table :

1
2
3
4
5
6
> cd /var/lib/mysql/recurser
>  myisamchk -r wp_options                                                                                                                            (06-18 19:16)
- recovering (with sort) MyISAM-table 'wp_options'
Data records: 181
- Fixing index 1
- Fixing index 2

After this everything seemed to run normally again. There are a lot of other myisamchk options if this simple fix doesn’t work for you - if the man pages aren’t any help a quick google should reveal loads of info.

More information available here and here .