How-to Restore WordPress Site

By | April 6, 2015

Advertisement from Google

In conclusion of “How-to Backup WordPress Site” article, here is small instruction to restore your backup:

Upload files to VPS

Upload you www.tar.gz and database.sql to the new VPS. You can use WinSCP (as described here)

Extract www file structure

Extract files:

tar -xvf www.tar.gz

And copy files:

cp -a www/* /var/

Advertisement from Google

Change permissions:

cd /var/
chown www-data:www-data -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Create and restore database

Create user and database:

mysql -u ROOT_DB_USER -pROOT_DB_USER_PASSWORD -e "create database NEW_DB_NAME; grant all privileges on NEW_DB_NAME.* to NEW_DB_USER@localhost identified by 'NEW_DB_USER_PASSWORD'"

Restore backup:

mysql -u NEW_DB_USER -pNEW_DB_USER_PASSWORD NEW_DB_NAME < database.sql

Configure nginx or apache

Copy config from the old server to the new one, or configure from scratch (nginx config for wordpress).

Leave a Reply

Your email address will not be published. Required fields are marked *