To take the backup of all db's

mysqldump --all-databases > backup.sql

To repair all the db's

mysqlcheck --all-databases --auto-repair