Symptoms
-
Plesk full backup task got failed with
Failed to execute backup of mysql database
-
Manual backup of domain's database results in error:
# plesk db dump db_name > database_backup.sql
mysqldump: Got error: 145: Table './db_name/toc_whos_online' is marked as crashed and should be repaired when using LOCK TABLES -
The following error appears during a migration process:
WARNING: (mysql object 'db_name') Not all the data was backed up into /var/cache/<timestamp>/clients/ccia/domains/domain.tld/databases/db_name_1 successfully
[....]
mysqldump: Got error: 145: Table './db_name/Logs' is marked as crashed and should be repaired when using LOCK TABLESOr
stderr: mysqldump: Got error: 144: "Table './db_name/table_name' is marked as crashed and last (automatic?) repair failed" when using LOCK TABLES
Cause
Database table corruption.
Resolution
Repair the corrupted database using one of the following methods:
Via Plesk GUI
- Log in to Plesk
- Navigage to Plesk > Domains > example.com > Databases > db_name and click Check and Repair:
Via phpMyAdmin
-
Log in to Plesk;
-
Navшgate to Plesk > Domains > example.com > Databases > db_name and click phpMyAdmin:
-
Click SQL button and run the following query:
REPAIR TABLE table_name;
Where table_name is the name of the table to repare
Via SSH
-
Connect to the server via SSH;
-
Execute the command:
# MYSQL_PWD=
cat /etc/psa/.psa.shadow
mysqlcheck -uadmin -r db_name table_nameWhere db_name is the name of the database where table table_name to be repaired.
Note: if the solutions below don't help, the affected database should be restored from a backup.