MySQL database backup

This article explains how to use backup scripts to create a MySQL database dump and include it in a backup plan.

General information

The MySQL database backup process in Xopero ONE consists of two steps:

  1. Creating a database dump using backup scripts.

  2. Backing up the database dump.

The first step is performed through Xopero ONE using the backup scripts feature. The second step is a standard file-level or image-level backup executed directly by Xopero ONE.

By using the mysqldump tool, Xopero ONE supports all MySQL versions that are officially supported by Oracle.


Backup configuration

If a file-level backup plan has already been created and is running, you can skip directly to step 6.

1

Log in to , go to the Backup tab (Plans > Backup) and click the + Add plan button in the top toolbar.

2

Select Devices from the platforms list.

3

In the next aside, select one of the available options and choose one or more devices for the plan to apply to (you can also select the plan to include all activated devices).

4

Define the name of the backup plan.

5

Configure your backup plan according to your needs (more information about the backup plan setup can be found in File-level backup and Image-level backup articles).

6

Go to the Advanced settings section and click Edit to customize additional options.

7

Scroll down to the Backup scripts section and click the Pre-task script toggle to turn it on.

8

Select one of the scripts dedicated to backing up the MySQL database environment (Windows or Linux).

9

Type your database username into the Database user field.

10

Choose the user password by opening the Password Manager, where you can either add a new password or select an existing one.

11

Set up the script arguments — it should be entered in the Script arguments field as follows:

Windows
database output_dir mysqldump_dir port
Linux
database output_dir port
  1. database — the name of the database. To include multiple databases in one backup plan, enter their names in the following format: [database1 database2 database3]. To back up all databases, use the --all parameter instead of specifying a database name.

  2. output_dir — the directory where the database dump will be saved. This directory must also be selected in the Data to protect section when creating a backup plan.

  3. mysqldump_dir — the path to the mysqldump utility.

  4. port — an optional parameter. Enter the port number only if a non-standard port is used. The default port is 3306.

For example, to back up all databases from the MySQL environment, use the following arguments:

--all C:\MySQLBackup\ "C:\Program Files\MySQL\MySQL Server 8.0\bin"

If you want to back up only selected databases from the MySQL environment (for example, two out of seven), use the following arguments:

database1 database2 C:\MySQLBackup\ "C:\Program Files\MySQL\MySQL Server 8.0\bin"
12

Enable the two additional options using the checkboxes:

  1. Wait for the script to continue the task — the application will wait until the dump is ready.

  2. Fail the task if the script fails — if the script fails, the system will notify you of the backup error.

13

Double-check your settings and click Save to close the Advanced settings aside.

14

After completing the configuration, click the Save button. The protection plan will then automatically begin protecting your devices and databases according to the schedule you defined.

15

That’s all you need to do to create the database dump — this file should now be included in the Data to protect section if you are performing a file-level backup (to back up only the database). Alternatively, you can run an image-level backup to protect the entire drive.


Last updated