myisamchk on the problematic table
I’ve run into the following error in my Apache
Table 'database.tablename' is marked as crashed and last (automatic?) repair failed
Fortunately the fix is simple: run
myisamchk on the table which is marked as crashed:
$ sudo su # service mysql stop # cd /var/lib/mysql/databasename # myisamchk -r tablename MyISAM-table 'tablename' is not fixed because of errors Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag # myisamchk -r -o -f tablename Data records: 107435 Found block that points outside data file at 16166832 # service mysql start
I’ve run into these errors before due to running out of disk space on the (admittedly tiny) VPS I had.
I also had this problem with a WordPress database able, causing the often-seen and unhelpfully terse:
Error establishing a database connection
Interestingly, this wasn’t getting bounced to
error.log, and I had to use the WordPress database repair screen to track down which one needed the fix (which was the same
All sorted now!