Fix MyISAM MySQL Tables with myisamchk

At times MyISAM tables in MySQL can crash and repair with PHPMyAdmin or from within the MySQL Server console won’t work. In these cases, this is how to repair (recover) the MyISAM table with myisamchk using these steps:

Go to the database directory with:

cd /var/lib/mysql/[database name]

Run myisamchk with:

myisamchk -r [table name]

Should that fail, use:

myisamchk -r -v -f [table name]

The flags mean:

  • -r = recover
  • -v = verbose
  • -f = force

https://dev.mysql.com/doc/refman/8.0/en/myisamchk-repair-options.html