To check and repair all databases in a database run
mysqlcheck -A --auto-repair -u root -p
Forcefully optimize all tables, automatically fixing table errors that may come up.
mysqlcheck -A --auto-repair -f -o -u root -p
To check all databases
mysqlcheck --all-databases -u root -p -c
To analyze all tables in all databases:
mysqlcheck --all-databases -u root -p -a
To repair all tables in all databases:
mysqlcheck --all-databases -u root -p -r
To optimize all tables in all databases:
mysqlcheck --all-databases -u root -p -o
To check all tables in a database, run
mysqlcheck --databases DB_NAME_HERE
See MySQL Repair