views:

151

answers:

1

Hi,

Is there any way in MySQL to only log deletes? I tried using the mysql binary log option but unfortunately, there are too many inserts to my database and the file swells instantly. If I let it grow for more than a day or so it will take up all the room on the server. I just want to log deletes for disaster recovery purposes. Any thoughts?

+1  A: 

A log file contains all changes to a database. It can be used to roll a backup forward:

After a backup file has been restored, the events in the binary log that were recorded after the backup was made are re-executed. These events bring databases up to date from the point of the backup

But in order to roll a database forward, the log has to contain all updates, not just deletes. So I don't think you can change it to just log deletes.

Is it an option to make full backups more often? After a full backup, you delete the old log files. That's a good way to keep the size of the binary log under control.

The MySQL binary logs take up disk space. To free up space, purge them from time to time. One way to do this is by deleting the binary logs that are no longer needed, such as when we make a full backup:

shell> mysqldump --single-transaction --flush-logs --master-data=2 \
     --all-databases --delete-master-logs > backup_sunday_1_PM.sql
Andomar