how to save mysql dumps for N days?

0

Is there any best practice for saving mysql-dumps daily backups for 30 days and then delete them, without writing scripts that checks date and delete?

maybe a builtin tool?

Roey

Posted 2015-04-27T07:40:38.233

Reputation: 121

Answers

0

You can use logrotate for that. A sample logrotate configfile could look something like this, assuming that you use a cronjob to save a daily mysql-dump in /home/myuser/mysqldumps/mydb.sql:

/home/myuser/mysqldumps/mydb.sql {
        daily
        missingok
        rotate 31
        notifempty
}

Adding compress can be considered to reduce diskspace.

Teun Vink

Posted 2015-04-27T07:40:38.233

Reputation: 2 107