You can only achieve this with a hack, and this is likely to cause problems. MySQL replication is not designed for this.
Imagine that you insert a record into your master, it is copied to the subordinate. Then you delete from the master, but it does not delete from the slave. If someone adds an entry with the same unique key, there will be a conflict on the follower.
Some alternatives:
- If you want to make a backup, I will do it in a different way. You can do periodic backups using cronjob, which launches mysqldump, but this assumes that you do not want to save EVERY record, only create periodic recovery points.
- Triggers to update the second mirror database. However, this cannot cross servers; you will have to recreate each table with a different name. In addition, the computational cost will be high, and restoring from this backup will be difficult.
- Actually, do not delete anything, just create a βStatusβ field that is active or disabled, then hide βDisconnectedβ from users. This also has problems, for example, ON DELETE CASCADE cannot be used, all this must be done manually in the code.
Perhaps if you indicate the reason why you want this mirror database without deleting, I can give you a more focused solution.
source share