Backup data is used to cope with data loss or damage. You can set a backup policy for the system to automatically back up the data and logs of an RDS for MySQL instance. Alternatively, you can manually back up the data and logs.

Note This topic describes the default backup function, which stores backup files to the region where your RDS instance is located. You can also store the backup files to another region. For more information, see Back up data across regions.

Fees

Each RDS instance has a specific quota of free backup space. If the size of backup files exceeds the quota, additional fees are incurred. We recommend that you specify a proper backup cycle that can meet your service requirements while also maximizing backup space utilization. For more information about the quota of free backup space, see View the quota of free backup space for an RDS for MySQL instance.

Note

Precautions

  • Do not perform DDL operations during the backup. Otherwise, tables are locked and consequently the backup fails.
  • Back up data and logs during off-peak hours.
  • If the data volume is large, the backup may take a long time.
  • Backup files are retained for a specified time period. Download the backup files to your computer before they are deleted.

Overview

Data backup Log backup
  • MySQL 5.5/5.6/5.7/8.0 High-availability/Enterprise Edition (with local SSDs):
    • Automatic backup supports full physical backup.
    • Manual backup supports full physical backup, full logical backup, and single-database logical backup.
  • MySQL 5.7/8.0 High-availability Edition (with SSDs or ESSDs):

    Only snapshot backup is supported. You can restore data from a snapshot to a new RDS instance but cannot download the data.

  • MySQL 5.7/8.0 Basic Edition (with SSDs):

    Only snapshot backup is supported. You can restore data from a snapshot to a new RDS instance but cannot download the data.

  • Binary log files occupy the disk space of an RDS instance.
  • If the size of a binary log file exceeds 500 MB or data has been being written into a binary log file for more than 6 hours, the system stops writing data into this file and starts to write data into another file. The earlier binary log file is then uploaded asynchronously.
  • You can upload binary log files to OSS with a few clicks without interrupting the data restoration function. Additionally, binary log files do not occupy disk space.
Note
  • Basic Edition does not allow you to upload binary log files with a few clicks.
  • You cannot access the OSS bucket where binary log files are located.

Set a backup policy for automatic backup

ApsaraDB for RDS can automatically back up databases according to the backup policy you set.

  1. Log on to the RDS console.
  2. Select the target region.选择地域
  3. Find the target RDS instance and click the instance ID.
  4. In the left-side navigation pane, click Backup and Restoration.
  5. On the Backup and Restoration page, click the Backup Settings tab. On the Backup Settings tab, click Edit.
  6. In the Backup Settings dialog box, set the backup parameters and click OK. The following table describes the parameters.
    Table 1. Backup parameters
    Parameter Description
    Data Retention Period The data retention period spans from 7 days to 730 days. The default retention period is 7 days.
    Note For MySQL 5.7 Basic Edition (with SSDs), the data retention period is 7 days and cannot be changed.
    Backup Cycle Select one or more workdays.
    Backup Time You can select any time period, which is measured in the unit of hour. We recommend that you select a time period during off-peak hours.
    Log Backup The status of the log backup function.
    Notice If you disable the log backup function, all log backup files are deleted and the time-based data restoration function becomes unavailable.
    Log Retention Period
    • The number of days in which log backup files are retained. The default retention period is 7 days.
    • The log retention period spans from 7 days to 730 days and must be shorter than or equal to the data retention period.
    Note For MySQL 5.7 Basic Edition (with SSDs), the log retention period is 7 days and cannot be changed.
    备份设置

Manually back up data

This section uses the single-database logical backup for MySQL 5.7 High-availability Edition (with local SSDs) as an example.

  1. Log on to the RDS console.
  2. Select the target region.选择地域
  3. Find the target RDS instance and click the instance ID.
  4. In the upper-right corner of the Basic Information page, click Back Up Instance.
  5. In the Back Up Instance dialog box, set the backup parameters and click OK.Physical backup
    Note If you set the Select Backup Mode parameter to Logical Backup and the Backup Policy parameter to Single-Database Backup, select a database from the left and click > to add the database to the list on the right. If the RDS instance does not have a database, you must create databases according to Create accounts and databases for an RDS for MySQL instance.
    单库逻辑备份

FAQ

  1. Can I disable the data backup function for an RDS for MySQL instance?

    No, the data backup function must be enabled. However, you can lower the backup frequency to at least two times a week.

  2. Can I disable the log backup function for an RDS for MySQL instance?

    Yes, you can disable the log backup function if your RDS instance does not run the MySQL Basic Edition.

  3. Why does the backup fail sometimes?

    If you perform DDL operations during the backup, tables are locked and consequently the backup fails.

Reference

APIs

API Description
CreateBackup Creates a backup set.
DescribeBackups Lists backup sets.