我刚刚通过我的提供者的API自动创建了一个mysql 5.6主/从关系,这意味着我没有root用户。所以在设置了slave之后,我启用了slave上的root用户,这当然打破了复制。我需要跳过那个GTID,但我很难理解这个问题。
STOP SLAVE;
SET GTID_NEXT="5b182ac6-8a79-11e4-8f28-001851cf5e10:10";
BEGIN; COMMIT;
SET GTID_NEXT="AUTOMATIC";
START SLAVE
导致相同的错误。什么是正确的GTID选择?
*************************** 1. row ***************************
Slave_IO_State: Waiting for the slave SQL thread to free enough relay log space
Master_Host: 10.188.52.218
Master_User: slave_6b72a386
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: replica-1007782573-bin.000006
Read_Master_Log_Pos: 1071986205
Relay_Log_File: replica-1130155763-relay.000003
Relay_Log_Pos: 5880
Relay_Master_Log_File: replica-1007782573-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1396
Last_Error: Error 'Operation CREATE USER failed for 'root'@'%'' on query. Default database: ''. Query: 'CREATE USER 'root'@'%''
Skip_Counter: 0
Exec_Master_Log_Pos: 5644
Relay_Log_Space: 5370067417
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1396
Last_SQL_Error: Error 'Operation CREATE USER failed for 'root'@'%'' on query. Default database: ''. Query: 'CREATE USER 'root'@'%''
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1007782573
Master_UUID: 5b182ac6-8a79-11e4-8f28-001851cf5e10
Master_Info_File: /var/lib/mysql/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: 141223 15:14:12
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 5b182ac6-8a79-11e4-8f28-001851cf5e10:9-5851
Executed_Gtid_Set: 08bc8aa0-8a7a-11e4-8f2d-001851502460:1-41,
5b182ac6-8a79-11e4-8f28-001851cf5e10:9-69
Auto_Position: 0
答案 0 :(得分:0)
查看已执行的GTID集。
Executed_Gtid_Set: 08bc8aa0-8a7a-11e4-8f2d-001851502460:1-41,
5b182ac6-8a79-11e4-8f28-001851cf5e10:9-69
08bc8aa0-8a7a-11e4-8f2d-001851502460
可能是你的奴隶,你的主人是
Master_UUID: 5b182ac6-8a79-11e4-8f28-001851cf5e10
你可以看到上面的几行。因此,从主人那里执行交易9-69。所以下一个GTID是70。
另请注意,您应该使用Auto_Position: 1
语句设置CHANGE MASTER TO
。阅读更多相关信息here。