How do I back up and restore the database of a RDS for MySQL instance?

1. Use mysqldump to back up and restore databases

Install the MySQL client on the ECC instance of the Linux.
• Run the following command to download the MySQL client.

  1. ```
  2. wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
  3. ```

• Run the following command to install the MySQL client.

  1. ```
  2. rpm -ivh http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm
  3. ```

2. Run the following command to back up the database of the apsaradb for RDS instance.

  1. mysqldump -h [$Host] -u [$User] -P [$Port] -p --opt --default-character-set=utf8 --triggers --hex-blob [$Database_Name] > /tmp/db_name.sql

mysqldump completes the backup operation automatically after you enter the password. A similar output is displayed.

3. Run the following command to confirm that the SQL file is successfully generated.

  1. ```
  2. ll /tmp/db_name.sql
  1. #### 4. To restore data from the source RDS instance, run the following command based on the backup file.
  1. mysql -h [$Host] -u [$User] -P [$Port] -p [$Database_Name] < /tmp/db_name.sql
  2. ```

A similar output is displayed, indicating that the recovery operation is completed after you enter the password.