备份与恢复

文件备份

# mkdir /home/backup
# cd /home/wwwroot
# tar -zcvf XXX-2020-06-18.tar.gz XXX.com
# mv XXX-2020-06-18.tar.gz /home/backup/

文件恢复

# cp /home/backup/XXX.com-2020-06-18.tar.gz /home/wwwroot
# cd /home/wwwroot
# tar -zxf XXX.com-2020-06-18.tar.gz
# rm -rf XXX.com-2020-06-18.tar.gz

数据库备份

# cd /home/backup
# lnmp database list
# mysqldump -u root -p XXX > XXX-2020-06-18.sql

数据库恢复

# mysql -u root -p
# show databases;
# use XXX;
# source /home/backup/XXX.sql;

删除与新建数据库

# mysql -u root -p
# drop database XXX;
# create database XXX;

备份到其他VPS

# cd /home/backup
# ls
# scp -P 端口 文件名称 root@IP:/home/backup

Archived: Job