View Source

{note:title=Notice}In Server Backup, end-user-level MySQL backup is not supported. Only super-users can make a MySQL backup. Sub-users are limited by protected machine user permissions.
{note}

To allow Server Backup to see the MySQL database in the client, you must enter information about the database in the policy. Follow the instructions below add a MySQL instance to a policy.

{info:title=Note}To add a MySQL Instance to your Server Backup, you will first need to install the MySQL database driver. See [ServerBackupManager:Install MySQL Connector JDBC into Server Backup] for detailed instructions.
{info}
1. When [creating a new policy|ServerBackupManager:Create policies], select the _MySQL_ tab in the _Create New Policy_ window.

!Create New Policy - MySQL.png|border=1!


You can also add a MySQL instance after the policy has been added, and even while it is running. Select the _MySQL_ tab in the _Edit Policy_ window. For more information, see [Edit policies].

2. In the MySQL tab, click the *Add New MySQL Instance* button. The _Add Database Instance_ window displays, where you can add the MySQL instance.

3. In the _Introduction_ section of the _Add Database Instance_ window, review the introductory information and click *Next* to proceed.

!Add Database Instance 1.png|border=1!
{info:title=Note}


If you see the following error message, the database driver is not installed on your machine.

!MySQL database driver not found.png|border=1!
See [Install MySQL Connector JDBC into Server Backup] for detailed instructions on how to install the driver.
{info}


4. In the _Name_ section, define the name for your database and enable or disable the database instance.

!Add Database Instance 2.png|border=1!

Click *Next* to continue.

5. In the _Host_ section, enter the information about the host to which you need to connect. By default, the protected machine's current hostname is used.

!Add Database Instance 3.png|border=1!
* *Use Alternate Host Name/IP* \- Select this option to specify an alternate hostname or IP.
* *Host Name/IP -* Specify the host name or IP address if it differs from the Server's current hostname/IP address. When using MySQL on a [Parallels Virtuozzo Containers (PVC)|ServerBackupManager:Add a MySQL instance to a policy on a PVC container] container, add the IP address of the MySQL container.
* *Port Number* \- By default, the "3306" port number is used. If you use another port number to connect to the database in your environment, specify the port number in this field.

{note:title=Notice}The \*Use Alternate Host Name/IP *option should be selected in the following cases:
* Multiple network interfaces are configured on the host, each with a different IP address configured for connection. Example: {{eth1}}

_Or_
* When you have configured multiple IP addresses over the same network interface. Example: {{eth0:1}} (Aliasing). The _Use Alternate Host Name/IP_ option is *not* used to connect to another host.{note}
Click the *Next* button to continue. 

6. In the _Authentication_ section, you must specify the authentication credentials to connect to the database instance.

!Add Database Instance 4.png|border=1!
* *Username* \- Enter the name of a user who has full administrator-level access to the database Instance you want to back up.
{info:title=Note}You do not need to create a new user to allow remote connections to a MySQL Instance. While adding a MySQL Instance to the Policy, you can use the credentials of any MySQL user with full access to the MySQL server from {{localhost}}. For example, you can use the MySQL "root@localhost" account, which is typically created during MySQL server installation.
{info}
* *Password* \- Enter the password of the above-mentioned user.

Click *Next* to continue.


7. _(Optional)_ In the _Data Directory_ section, you can define the path of the data directory. By default, the application discovers where the database stores its data files. In some environments, the data directory is located under a different path than the discovered path. For these cases, you can specify the exact path to the database's data directory.

In order to properly restore the MySQL container, add the path of the MySQL container, e.g., {{/var/lib/mysql}}.

{info:title=Note}Do not use the PVC Hardware Node’s path.{info}
!Add Database Instance 5.png|border=1!


Click *Next* to continue.

8. In the _Base Directory_ section, specify a base directory to use (if it differs from the standard directory). By default, the system attempts to automatically determine where on the file system the necessary program files are located. In some environments, the automatic method fails. To remedy this, you can choose to specify the exact path for the base directory. This will ensure that the system can locate the necessary files.

!Add Database Instance 6.png|border=1!

Click *Next* to continue.

9. In the _Options_ section, you can "Specify a Virtuozzo Container ID" and "Get MySQL table statistics."
{info:title=Note}Receiving MySQL table statistics may slow down the replication process.
{info}
!Add Database Instance 7.png|border=1! 

To set up a MySQL database on a PVC container, you will need to specify the following:
* *Host* \- "Use Alternate Host Name/IP" must be checked with the host name/IP address and port details added.
* *Authentication* \- Username and password for the MySQL Instance.
* *Options* \- "Specify a Virtuozzo Container ID" must be checked and the container ID added.

Read more in [Add a MySQL instance to a policy on a PVC container].

Click *Next* to continue.

10. In the final _Summary_ section, review the settings you have selected in the previous sections.

!Add Database Instance 8.png|border=1!

Once you have verified that the specified settings are correct, click *Add* to add your MySQL Instance to the policy.

11. The wizard screen closes, and the added MySQL Instance appears on the _MySQL_ tab of the _Create New Policy_ window. Instance options are displayed in the appropriate columns.

!Edit Policy - MySQL example.png|border=1!

It is possible to apply the following actions to the MySQL Instance from the corresponding _Actions_ menu:
* *Edit* \- Opens the _Add Database Instance_ wizard where you can change the Instance settings.
* *Remove *\- Removes the Instance without prompting you to confirm the removal.
* *Test Connection* \- Attempts to connect to the database at the specified host and port using the provided authentication credentials. Optionally performs Flush and Lock check.
* *Disable* \- Disables the MySQL Instance. A disabled Instance retains its configuration, but will not be backed up when the Policy executes.

12. If you are adding a new policy, complete the MySQL Instance add process by clicking the *Create* button in the _Create New Policy_ window. You can also click the *Create and Run* button to run the new policy immediately.

If you are adding the instance to an existing policy in the _Edit Policy_ window, click the *Save* button.

{excerpt:hidden=true}Instructions on how to add a MySQL Instance to a policy in Server Backup Manager.{excerpt}