RDS for MySQL logical backup file recovery to self-built database

Mysqldump tool comes with MySQL database can be restored by a logical backup file will be described in detail herein, the logic of the database backup and recovery procedures.

Explanation

Precautions

Local MySQL database installed on 64-bit Linux systems, and is the same version of MySQL cloud database version. As used herein, the operating system and MySQL5.7 demo version Linux7 an example.

Prerequisites

Examples versions are as follows:

  • MySQL 8.0 version of the highly available local disk
  • MySQL 5.7 version of the highly available local disk
  • MySQL 5.6
  • MySQL 5.5

Logical backup and recovery procedure

  1. Login RDS Management Console .

  2. In the upper left corner of the page, select the region where the instance.

  3. Find the target instance, click the instance ID.

  4. In the left navigation bar, click Backup and Recovery.

  5. Select a time range query, and then click Query.

  6. In the data backup list, find the logical backup you want to download, and click to the right of

    download

    Description If there is no download button, make sure your instance version supports downloading logical backup files .

  7. In the instance backup file download window, click Copy external network address, external data acquisition network backup file download address.
    img

  1. Log in self-built database where Linux systems, execute the following command to download the logical backup files.

    wget -c '<数据备份文件外网下载地址>' -O <自定义文件名>.tar

    Explanation

    • -c: HTTP mode is enabled.
    • -O: to save the results for the specified file downloaded.
  2. Execute the following command to decompress logical backup files, including the default database compression and database files on their own to create a compressed file.

    tar xvf <数据备份文件名>.tar
  3. Decompress compressed files corresponding database based on the need to restore the database again.

    gzip -d <数据库压缩文件名>.gz
  4. Log database creates a corresponding empty database.

    #mysql -uroot -p<数据库密码>
    mysql> create database <数据库名>;
    Query OK, 1 row affected (0.00 sec)
    mysql> exit
    Bye
  5. .Sql using a command file into a corresponding database.

    mysql -uroot -p<数据库密码> <创建的空数据库名> < ~/<解压缩后数据库名>.sql
  6. After logging in to view the database table, we have data on the migration has been successful.
    img

Guess you like

Origin www.cnblogs.com/sanduzxcvbnm/p/11640083.html