ManageWP is my goto choice for managing WordPress and WooCommerce stores. The incremental backups ManageWP offer along with simplified update management with the automatic rollback from the safe update feature make it really attractive if you have maintenance clients or manage a lot of sites and stores. It also helps make developer life easier if you can send a link to a zip file that contains the backup files and database. This tutorial will show you how to restore a ManageWP backup zip file using WP-CLI.
It is a very good idea to verify your backups actually work, backups are useless unless you know they work!
How to Restore ManageWP Backups with WP-CLI
First we need to generate the backup zip using ManageWP.
Click the green Download button to begin the backup zip generation.
After a few minutes ManageWP will send you a link to the zip file it generated from your backup files.
Right click the blue download button to get the URL
Now that we have the download link from ManageWP you can SSH into your server where you wish to restore the backup.
Make a temporary directory on the server
mkdir /tmp/site-backup
cd /tmp/site-backup
We are going to use wget to download the zip which has this format wget -O /tmp/site-backup/managewpbackup.zip
wget "https://mwp-orion-public-eu.s3.eu-west-1.amazonaws.com/backups/1313501/guides.wp-bullet.com_2019-Apr-12_backup_5cb1ee70bb0f39.67090196.zip" -O managewpbackup.zip
Unzip it (run sudo apt install unzip
if you don’t have unzip)
unzip -q managewpbackup.zip
We are going to copy all of the site files over to our destination path, here it is /var/www/guides.wp-bullet.com
. We are going to exclude the managewpbackup.zip
file and the wp-config.php
files.
I am also excluding the mwp_db
folder since that contains the MySQL database dump and we don’t want that exposed. We will be importing the database in the next step
rsync -a --info=progress2 /tmp/site-backup/ /var/www/guides.wp-bullet.com/ --exclude=mwp_db --exclude=managewpbackup.zip --exclude=wp-config.php
This guide assumes you already have the empty WordPress site and database configured correctly.
Let’s find out the name of the database dump so we can import it.
ls /tmp/site-backup/mwp_db
Based on this output we can see the filename is guideswpbullet.com.sql
Go to the site folder (here /var/www/guides.wp-bullet.com
and import the database using WP-CLI.
cd /var/www/guides.wp-bullet.com
wp db import /tmp/site-backup/mwp_db/guideswpbullet.com.sql --allow-root
All done 🙂
If you need to do any domain changes then see this more in-depth tutorial.