I want to replicate all update statement from Master as a Insert at Slave end.

Is it possible like in SQL Server? If so, how?

I want to do it because, if any record on Master is updating and if same record is not present at Slave end, then instead of Replication tends to fail, it should insert that record at Slave end.

All insert on Master will act as Insert only at Slave end.

  • Use replace into instead of insert and if the record is already present, it would first delete the old one and would insert the new one and if it is not present it would simply insert. This way even if the master have a record which slave doesn't, it would be update at master and insert on slave. Hope it helps – Nawaz Sohail Jul 29 '15 at 3:05
  • how can i implement this ? – Ankit Kapoor Sep 4 '15 at 10:46

How about using INSERT ... ON DUPLICATE KEY UPDATE or REPLACE INTO on master itself?

| improve this answer | |
  • i understand this,but this is for updation (Insert on..) when duplicate primary key present. I want to replicate update happening on master as Insert at slave. – Ankit Kapoor Jul 28 '15 at 11:55
  • I doubt (but will be interested to know) if that's possible in MySQL! Mostly not. – mysql_user Jul 28 '15 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.