If you WordPress blog MySQL database is broken, maybe as a result of manual tweaking, and you get errors, you can let WordPress fix your broken database all by itself. To do so, open wp-config.php and add the following line at the end of that file:
define('WP_ALLOW_REPAIR', true);
This will ‘allow’ your WordPress installation to perform a database repair. If something went wrong, you will get the following error:
To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php
file. Once this line is added to your config, reload this page.
Then go to example.org/wp-admin/maint/repair.php and follow the instructions.
Reparing WordPress can take some time depending on the number of posts, post revisions, pages, … so be patient.
WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.
WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.

Repair and Optimize WordPress database
Once done, change your wp-config.php file to:
define('WP_ALLOW_REPAIR', false);
Or, simply comment or remove that line.