Backing Up MySQL Databases on Linux

For Cloud Backup

On Linux, to back up MySQL databases in a consistent state with your backup account, you can use a script to pause the databases for the snapshot creation time. Snapshot creation usually takes only a few seconds within the backup process. You can find sample scripts in the Acronis Knowledge Base.

To run the sample scripts, simply follow these steps:

  • Log in as an administrator.

  • Place the scripts in an appropriate directory on your server, such as /var/lib/Acronis/mysql/.

  • To run the sample scripts, you will need the .my.cnf file. Make sure it is in the root directory and edit it. To do this, enter the following commands:

    [root@localhost ~]# sudo cd /root
    [root@localhost ~]# sudo touch .my.cnf
    [root@localhost ~]# vi /root/.my.cnf

    Insert the user name and MySQL password. Paste this information into the following lines:
    user=MY_USERNAME
    Password=MY_PASSWORD

  • Open the Backup Console.

  • In the Devices > All Devices section, click the gear icon for the desired device.

  • Click Protect.

  • In the New Protection Plan area, click the three dots.

  • Click Edit.

  • Make sure that the Complete Machine backup source is selected.

  • Click Change next to Backup Options.

  • Click on Pre-post Commands.

  • Select whether the script should be executed before or after the backup and enter the script.

  • Click Done.

Each time the backup plan is executed, the stored scripts are now also executed.