Logrotate for MySQL Database Backup

These are the steps to create an automatic backup process which will create a backup file daily and rotate it every 4 days.

This will let you only store only the last 4 backups (or the quantity you want).

  1. Create the first backup file manually:
  2. Create your logrotate file which will contain the procedure

     
  3. Then you can test your script executing the following

     

That’s it. Now you will have your automatic backup process runing every single day and only storing the last 4 backups files.

Leave a comment