Restoring the self-built database through the full backup file .qp

1. Create a temporary directory

# cat /etc/issue
Ubuntu 18.04.5 LTS \n \l
mkdir data/

2. Unzip the full file

  • MySQL 5.7
xbstream -x -p 4 < ./全备文件.qp -C ./data/

innobackupex --parallel 4 --decompress ./data/

3. Delete the qp file

find ./data/ -name "*.qp" | xargs rm

4. Application logs

  • MySQL 5.6、5.7
innobackupex --apply-log ./data/

5. Backup data

5.1 Stop the MySQL database service

systemctl stop mysql.service

5.2 Back up the original database directory

mv /var/lib/mysql /var/lib/mysql_bak
mkdir /var/lib/mysql
chown mysql:mysql /var/lib/mysql

6. Copy the full backup file and modify the directory permissions

innobackupex --defaults-file=/etc/my.cnf --copy-back /data
chown -R mysql:mysql /var/lib/mysql

7. Start the database

systemctl restart mysql.service
journalctl -fu mysql

reference:

  1. Restoring to self-built database through backup file
  2. Restoring the self-built database from the HUAWEI CLOUD database .qp backup file

Guess you like

Origin blog.csdn.net/u010953692/article/details/131861475