Today, when I accessed my website, it showed “database connection failed”. I opened the mysql log file /var/log/mariadb//mariadb.log and saw the following error:
wp_options’ is marked as crashed and last (automatic?) repair failed
I tried to repair the wp_options table:
1 2 |
mysql -u username -p databasename repair table wp_options; |
and got the following error:
| domainhostseotool.wp_options | repair | error | Can’t create new tempfile: ‘./domainhostseotool/wp_options.TMD’ |
| domainhostseotool.wp_options | repair | status | Operation failed
How to repair the corrupted table?
go to /var/lib/mysql/domainhostseotool/ and execute the following command:
1 |
myisamchk -r -f wp_options.MYI |
The result is:
- recovering (with sort) MyISAM-table ‘wp_options.MYI’
Data records:6089
- Fixing index 1
Found row block followed by deleted block
- Fixing index 2
Data records: 6088
After repairing, the table wp_options is recovered and my website is working normally.