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
- Recovery by physical database backup files to self refer to RDS for MySQL physical backup file recovery to self-built database .
- MySQL cloud database version How to back up data, see the backup RDS data .
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
Login RDS Management Console .
In the upper left corner of the page, select the region where the instance.
Find the target instance, click the instance ID.
In the left navigation bar, click Backup and Recovery.
Select a time range query, and then click Query.
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 .
In the instance backup file download window, click Copy external network address, external data acquisition network backup file download address.
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.
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
Decompress compressed files corresponding database based on the need to restore the database again.
gzip -d <数据库压缩文件名>.gz
Log database creates a corresponding empty database.
#mysql -uroot -p<数据库密码> mysql> create database <数据库名>; Query OK, 1 row affected (0.00 sec) mysql> exit Bye
.Sql using a command file into a corresponding database.
mysql -uroot -p<数据库密码> <创建的空数据库名> < ~/<解压缩后数据库名>.sql
After logging in to view the database table, we have data on the migration has been successful.