Anyone in their right mind who is running a mission critical database is already doing daily backups of the database. Its not often feasible to backup the entire database more than that. Without a proper plan, you’re stuck with a possible 24 hour data loss in the event the server dies just prior to its next backup. All transactions throughout the day are lost.
Luckily you can configure MySQL to store binary logs of all transactions that modify data in the database. These logs are typically going to be much smaller than your entire database so you can simply back them up more frequently than your entire database backup. When recovering from a system failure you would simply first restore from a nightly backup. Then restore from your binary log backups to ultimately reduce your data loss to whatever interval your binary log backups are set to.
To do all this you need to add the following lines to your my.cnf file:
log-bin = /var/log/mysql/.whatever
binlog-do-db=
expire_logs_days=2
I like to store 2 days of binary logs just in case something is screwed up I have 2 days worth of transactions I can potentially restore from. When restoring you need to be careful not to repeat transactions from prior to your nightly backup. So, if your nightly backup was exactly at midnight, you want to make sure you restore only the binary logs that occurred after midnight. Then you need to set a cron job to do the backup for something like every 5 minutes and you’re good to go.