A MySQL Database Restore Operation Fails

Article ID: MSQL0019 A MySQL database restore operation fails.

Symptom

A MySQL database restore operation or log restore operation fails with the following error message in the MySqlRestore.log file:

47225 b89f 08/07 12:38:39 512557 MySqlChildProcess::ReadErrBuf() - ReadFile: LastError=0
47225 b89f 08/07 12:38:39 512557 MySqlChildProcess::ReadErrBuf() - Got Error ERROR 1840 (HY000) at line 22: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
47225 b89f 08/07 12:38:39 512557 MySqlChildProcess::WriteBuf() - Error Stream: ERROR 1840 (HY000) at line 22: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.
47225 b89f 08/07 12:38:39 512557 MySqlRestore::OnBufferPlData() - Failed to write data , rc=[0]

Cause

GTID-based replication is running on the MySQL server.

Resolution

  1. Use the following command to determine whether GTID-based replication is enabled on the MySQL server:
    mysql> show global variables like "%gtid%";
  2. If GTID-based replication is enabled, then use the following command to reset the master, and then restore the database.
    mysql> reset master;

Reset the master before restoring each database.