Xtrabackup is a necessary tool for creating hot MySQL backups. The tool creates a backup of the server (i.e. all databases at once) without locks and stops. Can be installed from packages:

If doesn’t exist by default.

Backup

First, copy the files of the current server using the command:

A subfolder with the current date (for example, 20201010132431) will be created in the / var / backups folder. After that, you need to put the change log to the data file:

Now this folder can be saved to the backup server and wait for the reason to use.

Recovery

For recovering, just copy the backup to the MySQL data folder (datadir parameter in my.cnf):

Periodic Copy

It is better to add a backup to cron and run it once an hour (a day, if the database takes up more than 10 GB):

Privacy Preference Center