All Products
Search
Document Center

Cloud Backup:Back up a MySQL database

Last Updated:Feb 29, 2024

To prevent data loss or corruption due to disasters, hardware failures, or accidental deletion, we recommend that you use Cloud Backup to back up your MySQL database in a timely manner. You can use Cloud Backup to back up MySQL databases that are deployed on Elastic Compute Service (ECS) instances or on-premises servers to the cloud. You can restore the data of a MySQL database to the source database, another ECS-hosted database, or an on-premises database within the same region based on recovery points. This topic describes how to back up a MySQL database.

Prerequisites

  • Cloud Backup is activated. You are not charged for activating Cloud Backup. You are charged for using the database backup feature of Cloud Backup based on the following billable items:

    • Rental of database backup vaults. You are not charged for using a vault in the first 30 days. You are charged after the free-trial period ends. You can store data from various databases.

    • Storage usage of database backup vaults. You are charged for the backup storage based on the storage space occupied by the data that is deduplicated and compressed. A free capacity of 100 GB is provided for each backup vault per month. After the free quota is used up, you are charged based on tiered pricing.

    For more information, see Pricing.

  • A MySQL database is registered in the Cloud Backup console.

    • Cloud Backup allows you to use the Discover Database feature to discover MySQL databases on the ECS instances where Cloud Assistant Agent is installed. You must obtain the database username and password. For more information, see Register an ECS-hosted MySQL database.

    • For a MySQL database deployed on an on-premises server, you must install a Cloud Backup client on your on-premises server. For more information, see Register an on-premises MySQL database.

  • For an ECS-hosted MySQL database, we recommend that you use the precheck feature to identify issues that may cause backup failure. The check items include the OSS connectivity check, control network connectivity check, check of versions that support full backup, and binlog check. For more information, see Precheck an ECS-hosted MySQL database.

Usage notes

  • On-premises database servers must be connected to virtual private clouds (VPCs) by using virtual private networks (VPNs) or Express Connect circuits. You must also make sure that you can use a Cloud Backup client to access one of the following CIDR blocks from an on-premises server: 100.64.0.0/10, 100.64.0.0/11, and 100.96.0.0/11. For more information, see Connect a VPC to a data center in single-tunnel mode.

  • The MySQL backup feature does not support anti-ransomware policies for databases or databases that are deployed in containers.

  • Cloud Backup supports a limited number of database versions, operating systems, and backup features. For example, Cloud Backup does not support backup of a MySQL database deployed on Windows. For more information, see the "Supported database versions" section in Overview (ECS-hosted databases).

Create a backup plan for the MySQL database

After the backup plan is created, the backup plan is in the Running state. Cloud Backup backs up the MySQL database from the specified start time at the specified interval. Perform the following operations:

  1. Log on to the Cloud Backup console.

  2. In the left-side navigation pane, choose Back Up > Database Backup.

  3. In the top navigation bar, select a region.

  4. On the Database Backup page, click the MySQL tab.

  5. Click the ECS Database Instance or Local Database Instance tab.

  6. Find the MySQL database for which you want to create a backup plan, and click Back Up in the Actions column.

  7. In the Create Backup Plan panel, perform the following steps:

    1. Configure the backup parameters and click Next.

      1. Specify Plan Name.

      2. Select the MySQL database that you want to back up.

    2. Configure the backup plan and click Next.

      Parameter

      Description

      Recommended Plan

      The recommended backup plan. Cloud Backup provides the following preconfigured backup policies. You can select a backup policy based on your business requirements or create a custom backup policy.

      • Typical Plan: enables the Full Backup and Incremental Backup features.

      • Critical Application: enables the Full Backup, Incremental Backup, and Log Backup features.

      • Customize: enables a custom backup policy. You can select incremental backup or real-time backup, and set the start time and backup interval.

      Full Backup

      If you select Full Backup, all the database files in the operating system are backed up. However, you can restore the files to only the point in time at which the files are backed up.

      You can back up files immediately or at a specified point in time. You can also schedule periodic backups by hour, day, week, or month.

      Incremental Backup

      If you select Incremental Backup, all incremental database files in the operating system are backed up. However, you can restore the files to only the point in time at which the files are backed up.

      You can back up files immediately or at a specified point in time. You can also schedule periodic backups by hour, day, week, or month.

      Important
      • If your MySQL database (earlier than MySQL 5.5) uses the MyISAM engine, you cannot perform incremental backup for the database. In this case, Cloud Backup still performs full backups even if you select Cumulative Incremental Backup for this parameter.

      • To restore an incremental backup file, Cloud Backup must obtain the most recent full backup file. Therefore, the full backup file is not recycled until the incremental backup file expires. We recommend that you configure a reasonable backup cycle and expiration time. For more information, see How does Cloud Backup clear expired database backup files?

      Log Backup

      You can back up database logs at a regular interval.

      You can back up files immediately or at a specified point in time. You can also schedule periodic backups by hour, day, week, or month.

      Important

      To restore a log backup file, Cloud Backup must obtain the most recent full backup file. Therefore, the full backup file is not recycled until the log backup file expires. We recommend that you configure a reasonable backup cycle and expiration time. For more information, see How does Cloud Backup clear expired database backup files?

      Realtime Backup

      If you select Realtime Backup, database logs are backed up in real time.

      Before you enable real-time backup, you must perform a full backup. After real-time backup is enabled, database logs are continuously backed up. Therefore, the recovery point objective (RPO) of data backups can be reduced to seconds. During the free trial period, you can perform real-time backups free of charge. When the free trial period expires, you are charged for the storage usage of real-time backups. For more information, see Pricing.

      Important

      You can create only one backup plan for a single MySQL database if you enable real-time backup for the backup plan.

    3. Configure the backup settings and click Next.

      Parameter

      Description

      Concurrent Threads

      The number of concurrent threads that are used to back up files.

      Retry Time

      The time interval between two consecutive reconnection attempts if the database is disconnected during backup. Unit: minutes.

      Speed Limit

      The maximum size of data that is backed up per second. Unit: MB/s.

      Note

      The value 0 indicates that the backup speed is not limited.

    4. Configure a backup vault. Click OK.

      Important

      You can back up an instance to only one backup vault.

      Parameter

      Description

      Backup Vault

      The backup vault to which you want to store the backup data. Valid values:

      • Create Vault: If you select this option, specify a name for the backup vault in the Vault Name field. If you do not configure this parameter, a random name is specified.

      • Select Vault: If you select this option, select a backup vault from the Vault Name drop-down list.

      Important

      After a backup vault is created, you are charged for the backup vault regardless of whether backup data is generated. For more information, see Billing methods and billable items.

      To maximize the redundancy of your backup data, Cloud Backup uses zone-redundant storage (ZRS)-enabled backup vaults by default in regions that support ZRS-enabled backup vaults. For regions that support only locally redundant storage (LRS)-enabled backup vaults, Cloud Backup uses LRS-enabled backup vaults. You do not need to manually select a backup vault type.

      Vault Name

      The name of the backup vault.

      Backup Retention Period

      The retention period of the backup data. Unit: days, weeks, months, or years.

      You can change the backup retention period on the Storage Vaults page. This change takes effect on all newly generated backup data in the backup vault. Data is automatically deleted when the retention period expires.

      Important

      To restore an incremental backup file or log backup file, Cloud Backup must obtain the most recent full backup file. Therefore, the full backup file is not recycled until the incremental backup file or log backup file expires. We recommend that you configure a reasonable backup cycle and expiration time. For more information, see How does Cloud Backup clear expired database backup files?

      The backup plan is created.

Backup is successful

  • A full backup is a prerequisite for an incremental backup. You must manually perform a full backup.

  • After the backup plan is created, you can view the backup plan details on the Backup Plans tab. The details include the next execution time and backup intervals for the full backup, incremental backup, and log backup. Cloud Backup backs up the MySQL database from the specified start time at the specified interval.

  • When the backup execution time is reached, Cloud Backup runs the backup plan. If the Status of a backup job is Idle and the time for Next Run is displayed, the backup job is completed.

image.png

FAQ

Related operations

On the Backup Plan tab, find the backup plan. In the Actions column, you can click buttons to perform the following operations:

  • Modify a backup plan

    If a backup plan does not meet your requirements, you can click Edit to modify the backup plan.

  • Configure alerts

    You can choose More > Alert Settings in the Actions column and then select a backup alert policy. The following table describes the alert policies.

    Alert policy

    Description

    Disabled

    The backup client does not send alert notifications.

    Same as Backup Vault

    The backup client sends alert notifications based on the alert settings that are specified for the backup vault.

    Default

    The backup client sends alert notifications to the owner of the Alibaba Cloud account by using emails.

    Custom

    If you select this option, you must select one or more contacts or contact groups. Then, the backup client sends alert notifications to the selected contacts or contact groups.

  • Delete a backup plan

    If you delete a backup plan, all backup and restoration jobs that are being performed based on the backup plan are interrupted.

    To delete a backup plan, find the backup plan and choose More > Delete Backup in the Actions column.

What to do next

Restore a MySQL database

References