# MySQL database backup

#### In Xopero ONE, you can back up a variety of databases, including Oracle, Microsoft SQL, PostgreSQL, and MySQL.

***

## 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

{% hint style="info" %}
If a file-level backup plan has already been created and is running, you can skip directly to **step 6**.
{% endhint %}

{% stepper %}
{% step %}
Log in to [**XMS**](#user-content-fn-1)[^1], go to the **Backup** tab (**Plans** > **Backup**) and click the **+ Add plan** button in the top toolbar.

<figure><img src="/files/4vnONYo4CncYWJyACJ9Z" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Select **Devices** from the platforms list.

<figure><img src="/files/yVkZcxR0fqG19URiCqnW" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
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).

<figure><img src="/files/Tq72SHtO1SUJpUTacYBE" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Define the name of the backup plan.
{% endstep %}

{% step %}
Configure your backup plan according to your needs (more information about the backup plan setup can be found in [File-level backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/file-level-backup.md) and [Image-level backup](/xopero-one-en/backup-and-recovery/workstations-and-servers/image-level-backup.md) articles).
{% endstep %}

{% step %}
Go to the **Advanced settings** section and click **Edit** to customize additional options.

<figure><img src="/files/MH4lFcHW2rABhPcc2YwI" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Scroll down to the **Backup scripts** section and click the **Pre-task script** toggle to turn it on.

<figure><img src="/files/wTJul7KL3MX6GnyRTHwM" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Select one of the scripts dedicated to backing up the **MySQL** database environment (**Windows** or **Linux**).

<div><figure><img src="/files/O31TMemkZXo3X97PwiWO" alt=""><figcaption></figcaption></figure> <figure><img src="/files/ci6KNDpVLb5CVyJrut9b" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Type your database **username** into the **Database user** field.

{% hint style="warning" %}
It is strongly recommended to create a dedicated user specifically for database backup operations.
{% endhint %}

<figure><img src="/files/NRK1mwL3znDssV5GeHKD" alt=""><figcaption></figcaption></figure>
{% endstep %}

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

<figure><img src="/files/tTTGSuQyBNpP6QOmjlAw" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Set up the script arguments — it should be entered in the **Script arguments** field as follows:

{% code title="Windows" overflow="wrap" %}

```
database output_dir mysqldump_dir port
```

{% endcode %}

{% code title="Linux" overflow="wrap" %}

```
database output_dir port
```

{% endcode %}

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**.

{% hint style="danger" %}
When using the `mysqldump` utility on **Linux**, connections to the host named **'localhost'** are established through a socket file. If you do not specify a port in the configuration, the tool will connect correctly even when using a non-standard port. However, if you connect via **127.0.0.1**, specifying a non-standard port is required.
{% endhint %}

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:

{% code overflow="wrap" %}

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

{% endcode %}

{% hint style="warning" %}
**Important!** The `mysqldump` tool is part of the **MySQL** server and should be installed by default. If, for any reason, it is not available, you can download the **MySQL Utilities** package, which includes the `mysqldump` tool.
{% endhint %}
{% endstep %}

{% step %}
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.

<figure><img src="/files/SUjRkBxzsLWWkrf1w2Tn" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Double-check your settings and click **Save** to close the **Advanced settings** aside.
{% endstep %}

{% step %}
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.

{% hint style="success" %}
You can also click **Save\&Run** button to immediately start the backup process, regardless of schedule.
{% endhint %}
{% endstep %}

{% step %}
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.
{% endstep %}
{% endstepper %}

***

## Useful links and items

{% embed url="<https://downloads.mysql.com/archives/utilities>" %}

[^1]: Xopero ONE Management Service


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpcenter.xopero.com/xopero-one-en/backup-and-recovery/workstations-and-servers/database-backup/mysql-database-backup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
