Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Definitely Read my guide on Backup WP via Crontab Script

Download this Restore-Wordpress-Website-from-TAR-and-SQL-dump.txt.

#Restore WordPress Website from TAR and SQL dump

##You can make a copy of script and use a program to FIND AND REPLACE to easily convert to working copy-paste code!
#[database] with WP MySQL database name
#[username] with WP MySQL username
#[password] with WP MySQL password

1. IMO you should delete the directory of your WordPress install if exists (make backup first) and then just unpack tar file and place it where it used to be!

2. The SQL file needs to be imported back into MySQL

If database exists remove it via:


mysql -u root -p

DROP DATABASE [database];


CREATE USER [username]@localhost IDENTIFIED BY '[password]'; # password goes inside ' ' IE: 'Myp@ss' not Myp@ss

GRANT ALL PRIVILEGES ON [database].* TO [username]@localhost;



*This assumes you followed my Backup Guide and created .sqlpwd file*

 mysql --defaults-extra-file=~/wp_backups/sqldumps/.sqlpwd [database] < ~/wp_backups/sqldumps/[dumpfilename].sql


OR if on new system or don't have .sqlpwd file use:

mysql -u [username] -p [database] < [sqldumpfilename].sql
--Apache must be configured the same as before, or other changes must be made, but that is beyond the scope of this guide.

I recommend practicing a full restore in a Virtual Box so you aren't doing it your first time when its mission critical time!

  • No labels

1 Comment