Mysql – Got fatal error 1236 Slave has more GTIDs than the master has, using the master’s SERVER_UUID

gtidMySQLmysql-5.6replication

We are testing replication using GTID's on two servers running MySQL 5.6. Replication was running fine, but now it is not functioning. When I run show slave status\G on the slave, I get the following error message

Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master
when reading data from binary log: 'Slave has more GTIDs than the
master has, using the master's SERVER_UUID. This may indicate that the
end of the binary log was truncated or that the last binary log file
was lost, e.g., after a power or disk failure when sync_binlog != 1.
The master may or may not have rolled back transactions that were
already replica'

I have tried to reset master and stop, reset, and restart slave, with no luck, and cannot find any information about this particular issue online.

Oddly, when checking show slave status\G on master, I get a different error.

Last_Errno: 1007 Last_Error: Error 'Can't create database 'repltest';
database exists' on query. Default database: 'repltest'. Query:
'create database repltest'

But when I check both the slave and the master, the database 'repltest' does not exist. This was just a database we created on master to check that replication was working, and we deleted it from the master afterward.

Edit – Note: this is a staging environment that does not have active database connections from any applications. This was set up merely to test replication with GTIDs

Best Answer

You probably have to restore the slave based on the procedure outlined on this blogpost. Once replication is fixed, you may then want to run pt-table-checksum and pt-table-sync to synch data between the two servers.