MySQL Database Restore

Before Restoring MySQL Database

There are two methods to recover MySQL database, Override Original Database and Redirect Restore to New Path.

For Override Original Database restore, MySQL database needs to be shut down. For example:

systemctl stop mysqld

An empty temporary directory needs to be created and should be granted with mysql user permission for storing cache data during the restoration process. For example:

mkdir /data 

chown -R mysql:mysql /data

All data in the original data directory (datadir) needs to be cleared before restoration, it’s recommended to rename the original data directory and create a new directory with the original data directory name, and it needs to be granted with mysql user permission, for example:

cd /var/lib/ 

mv mysql mysql.bk 

mkdir mysql 

chown -R mysql:mysql mysql

Notice

1. The above operations should be done by the MySQL database admin

2. The temporary directory is recommended to be created on the same partition as the original data directory.

3. For the datadir, it’s configured in the my.cnf file, the database admin should perform the above operations according to the actual environment.

For Redirect Restore to New Path, a temporary directory and a new data directory need to be created and need to be granted with mysql user permissions, for example:

mkdir /data 

chown -R mysql:mysql /data 

mkdir /data1 

chown -R mysql:mysql /data1

Notice

1. Redirect Restore to New Path does not require shutdown of MySQL database services.

2. The restored data will be saved in the new data directory, the database admin can use the restored data to create a new database or modify the my.cnf file to start MySQL database from the new data directory.

To restore databases from database backup restore points, please go to Database Backup > Restore page. There are 4 steps to restore databases from the database backup restore points.

Create Restore Job

Step 1: Restore Point

In the Restore Point dropdown list, select a backup node that stores the desired restore points. Select a target database restore point under your database that you want to restore. You can quickly find the target restore point by searching the job name, database name, or the date of the restore point. One restore job only can select one restore point.

Step 2: Restore Destination

After selecting the restore point, select Target Instance to restore.

Step 3: Restore Strategy

For Override Original Database restore, fill in the temporary directory path.

Notice

If you use log backup point to override the original database, MySQL service will auto restart, no need to manually start MySQL service. The [Start Command] is ‘mysql’ by default. It will be used to restart the database service. You need to change it to the service name of your environment instance. For example: this is a MySQL, fill in the service name as ‘mysql. Then the command ‘service mysql restart’ will execute.

For Redirect Restore the New Path restore, fill in the temporary directory path and the new data directory path.

Rollback time: if you had selected the log backup restore point, you can rollback MySQL database state within the given time range. If you disable rollback time it will by default restore to the latest time point of the backup when it’s been taken.

Same as database backup, while restoring databases, you can configure Transmission Strategy to encrypt the data transmission channel. You can also configure Throttling Policy to limit the database restore speed accordingly.

Step 4: Review & Confirm

After completing the above-mentioned settings, you can review and confirm the settings on one screen.

Once the job has been created, you’ll be redirected to the Monitor Center > Jobs page.

As the database restore job is by default to be executed right after the creation of the job, it will run automatically, when you see it in the current job list, it should be in running status already, and once completed, the job will be automatically deleted from the current job list.

After this, you can browse the restored job from History Jobs. Your restored data will be found in the path you configured while creating the restore job.

Notice

If you use log backup point to override the original database, MySQL service will auto restart, no need to manually start MySQL service.

results matching ""

    No results matching ""