How can I solve this GTID error when restoring through binlogs?

285 views Asked by At

I have a sequence of sql files created with the command mysqlbinlog binlog.000093 > log93.sql, from 93 to 109. These logs go back to the creation of the database, so I suppose I can fully restore the database. I need to restore the database to the state it was at a specific datetime. I tried to execute the command cat log93.sql | mysql -u root -p but I get the error @@SESSION.GTID_NEXT cannot be changed by a client that owns a GTID. The client owns ANONYMOUS. Ownership is released on COMMIT or ROLLBACK.

I tried two things:

  • I added:
[mysqlbinlog]
skip-gtids

in the my.cnf file, but nothing, I get the same error.

  • I added (instead of the previous configuration):
[mysqld]
enforce_gtid_consistency = 'ON'
gtid-mode = 'ON'

but I get the error @@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON.

I am running mysql Ver 8.0.33-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu)). How can I solve the issue and effectively restore the database?

0

There are 0 answers