开发者

Removing out-of-sync data from MySQL host with replication

开发者 https://www.devze.com 2023-01-02 07:23 出处:网络
I have a master-master replication setup and just found out that sometime during the initial testing (2 years ago) two extra rows where inserted in to only one host and now I\'d like to remove them so

I have a master-master replication setup and just found out that sometime during the initial testing (2 years ago) two extra rows where inserted in to only one host and now I'd like to remove them so that the DB's are fully in开发者_如何学Go sync. Can I just issue a delete of those rows on the host in question without replication going crazy because of missing rows on the other host? Or should I somehow skip replication for the delete command?


I think you can safely run the DELETE. If a WHERE - clause in a DELETE-statement does not match any rows of data, zero rows are deleted, but MySQL does not throw an error. That's why your DELETE-statement is perfectly valid on both servers, deleting two rows on one server and zero rows on the second server.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号