Backing Up MySQL Databases
Please use the “Print” function at the bottom of the page to create a PDF.
To backup MySQL databases in a consistent state on Linux with the MySQL Backup Console, you must stop the databases with a script for the time of snapshot creation. Snapshot creation usually only takes a few seconds. How to back up a MySQL database:
You have activated a backup package.
You have installed the Backup Agent on the server.
You have registered the server in the backup console.
You have created a backup plan in the Backup Console.
Step 1
Place the scripts in an appropriate directory on your server, e.g. /var/lib/Acronis/mysql/.
Please note: You can download sample scripts from the Acronis Knowledge Base. These can be found at https://kb.acronis.com/content/58136.
Please note: To execute the example scripts, the file .my.cnf must be located in the root directory.
Step 2
Open the root directory.
sudo cd /root/
Step 3
To change the access and change time stamp of the .my.conf file, type the following command:
sudo touch .my.cnf
Step 4
To edit the .my.cnf file, enter the following command:
vi /root/.my.cnf
Please note: The Vi editor has a command or command mode and an insert mode. You can enter the insert mode by pressing the i button. In this mode, the entered characters are immediately inserted into the text. To enter the command mode, press the ESC key. When you use Command mode, your keyboard input is interpreted as a command. vi cannot be terminated in Insert mode. Therefore, always enter command mode to exit vi.
Step 5
Insert the following information:
[client]
user={MySQL-Benutzername}
password={MySQL-Passwort}
Step 6
To save the changes and close the editor, type the following command:
:wq
Step 7
Open your browser and log into your backup account.
Step 8
In the navigation bar on the left, click Backup > Backup Plan.
Step 9
Open the Backup Console.
Step 10
Activate the desired server in the Devices > All devices area.
Step 11
Click Backup in the navigation bar on the right.
Step 12
To create a new backup plan, click Create New or Add Backup Plan.
Step 13
In the Backup Source list, select the desired source for your backup:
Complete machine: If you select the Complete machine option, all drives, including partitions, will be backed up. With this backup an entire system can be restored.
- Disks/Volumes: If you select the Disks/Volumes option, you can back up individual disks or volumes.
- Files/Folders: If you select the Files/Folders option, you can back up single or multiple files or folders.
Step 14
Click Planning.
Step 15
In the Schedule window, specify when you want the automatic backup to run. To save the settings, click Done.
Please note: At very short intervals, a backup process may take longer than the set interval.
Please note: If you do not specify a date range, the backup plan will run permanently.
Step 16
Click Retention Period.
Step 17
In the Cleanup list, select the desired cleanup method.
After backup age: Indicates for how many months, weeks, days and hours the backups should be retained retrospectively. The settings apply to the selected backup plan. If you select the Switch to single rule for all backup sets option, the set retention period applies to all backup plans.
By number of backups: Specifies the maximum number of backups to keep.
Store backups indefinitely: All backups are kept. No cleanup will be performed. Please note:
If there is not enough disk space available, no backups will be created. Therefore, make sure that there is always enough memory available.
Step 18
To return to the backup plan settings, click Done.
Optional: To save your backup encrypted, enable encryption. If you store your backups encrypted, you must enter the encryption password each time you access the backup.
Please note: The encryption password cannot be reset! Your backups cannot be restored without this encryption password. Therefore, keep the encryption password safe!
Step 19
In the desired backup plan, click .
Step 20
Click Backup Options.
Step 21
In the left navigation bar, click on Commands before/after data acquisition.
Step 22
In the Execute a command before data collection area, click Yes.
Step 23
In the Command or path to a batch file field on the machine with the agent, add the path to the script you want. Example: /var/lib/Acronis/mysql/pre-freeze-script.sh.
Step 24
In the Working directory field, insert the working directory that is on your server. Example: /var/lib/Acronis/mysql/
Step 25
In the Run a command after data collection area, click Yes.
Step 26
In the Command or path to a batch file field on the machine with the agent, add the path to the script you want. Example: /var/lib/Acronis/mysql/post-thaw-script.sh.
Step 27
In the Working directory field, insert the working directory that is on your server. Example: /var/lib/Acronis/mysql/
Step 28
Click on DONE.
Step 29
To save the settings, click CREATE. The backup plan is created.
Step 30
To perform a manual backup, click RUN NOW.