--set-gtid-purged
时间: 2023-10-08 10:04:04 浏览: 52
SET GTID_PURGED is a MySQL system variable that is used to control the global transaction identifier (GTID) state of the server. It sets the list of purged transactions, which means that the server will not replicate any transactions that occurred before the specified GTID.
When we set GTID_PURGED, we are telling MySQL that we are purging all transactions up to a certain point in time, and that all transactions before this point should not be replicated. This can be useful when we are setting up a new server and want to ensure that we only replicate data from a certain point forward.
To set GTID_PURGED, we can use the following command:
```
SET GLOBAL gtid_purged='GTID1, GTID2, GTID3';
```
Where GTID1, GTID2, GTID3 are the GTIDs that we want to purge up to.
Note that setting GTID_PURGED incorrectly can cause replication issues, so it is important to ensure that we have the correct GTIDs before setting it.