I’m looking for a way to prevent DELETE statement on a MySQL replication Master/Slave.

In my case, the Master is a live database, with fresh entries (not older than a week), and the Slave is an archive database which must contains all entries.

I have several problems with my test:

  • If I raise an exception in a Slave BEFORE DELETE trigger, like SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'DELETE canceled';

The SQL exception raise an error and stop my Slave.

  • If I raise a warning, the Slave keep running but the delete is not canceled
  • I can’t modify the my.cnf of MySQL.
  • I can’t use a boolean attribute for hide on master, show on slave (Master database must be as little as possible).

I rack my brain on this since a few days, and I ‘m running out of ideas …

Source: mysql

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.