Articles in this section

Dump of a MySQL/MariaDB database hosted on the Plesk server fails: mysqldump table doesn't exist when using LOCK TABLES

Plesk for Linux kb: technical ext: migrator ABT: Group A

Applicable to:

  • Plesk for Linux

Symptoms

  • Dump of a MySQL/MariaDB database hosted on the Plesk server fails:

    CONFIG_TEXT: mysqldump: Got error: 1146: Table '<TABLENAME>' doesn't exist when using LOCK TABLES

  • Backups have the following warning related to the database:

    CONFIG_TEXT: Unable to execute SQL: Table 'database_name.<TABLENAME>' doesn't exist in engine. SQL query: SHOW FULL COLUMNS IN `<TABLENAME>`

Cause

The table data has been corrupted. The InnoDB engine cannot open the table for locking.

Resolution

  1. Connect to the server via SSH
  2. Attempt to dump using --skip-lock-tables to workaround the lock requirement:

    # mysqldump --skip-lock-tables -u<db_user> -p<db_user_password> database_name > /root/database_dump.sql

    Note: If this succeeds, the dump is complete. If not, continue below.

  3. Attempt to repair the corrupted table using the native MySQL/MariaDB repair tool:

    # plesk db

    MYSQL_LIN: mysql> use database_name;
    mysql> REPAIR TABLE <TABLENAME>;

    Note: Replace <TABLENAME> with the table name shown in the error message.

  4. Retry the dump after the repair:

    # mysqldump -u<db_user> -p<db_user_password> database_name > /root/database_dump.sql

Note: If the database is still not dumpable and there are no valid backups, use innodb_force_recovery as a last resort: How to fix InnoDB corruption cases for the MySQL database?

Was this article helpful?

Comments

1 comment
Date Votes

Please sign in to leave a comment.