notes

How to repair a crashed WordPress database table

If you have root access on the host (e.g., VPS) where a MySQL sever is running, you can try command-line interface to fix the crashed database table.

For a MyISAM-type database, you can fix a crashed table with a command-line utility called myisamchk. This utility comes with MySQL server installation.

First, stop MySQL server.

$ sudo service mysql stop (Debian/Ubuntu)
$ sudo service mysqld stop (CentOS/RHEL)
$ sudo systemctl stop mysqld.service (Fedora)

Then use this command to fix a particular table.

$ cd /var/lib/
$ sudo myisamchk -r -v -f mysql/<database_name>/<table_name>

Finally, start MySQL server again.