MySQL Replication – Resolving Out of Sync Slave

MySQLreplication

I have a Master & Slave setup. Embarrassingly I managed to execute some data changing statements (INSERT and UPDATEs across 3 tables) on the Slave. Obviously this stopped the Slave replication.

I don't need the updates I accidentally made on the Slave. How can I get it back in sync with the Master?

Best Answer

you run this in slave host (pdb-0001 is remote Master DB)

mysqldump --add-drop-database -umiadmin -pXXX -h qdb-0001 -P3306 --single-transaction \
    --apply-slave-statements=true --include-master-host-port --master-data=1 \
    --databases c0006 | mysql -u miadmin -pXXXX -h 127.0.0.1