Backup and Restore a WordPress site

Instructions for backup and restore of WordPress site on Windows server.

  1. Install the plugin BackUpWordPress onto your site.
  2. Run a full backup including both files and database.
  3. Create a new site in IIS with a new physical path. Do not start the website.
  4. Create a new database and user in mySQL for the restored site:
    1. log in to mySQL shell.
    2. CREATE DATABASE newsite;

      http://dev.mysql.com/doc/refman/5.1/en/creating-database.html

    3. CREATE USER 'newsite@localhost' IDENTIFIED BY 'password';

      http://dev.mysql.com/doc/refman/5.1/en/create-user.html

    4. Alternatively use an existing user account and give it permissions on the new database:
      GRANT ALL PRIVILEGES ON newsite.* TO 'existing_user'@'localhost';
  5. Extract the files from the zip backup file to the physical path of the new site in IIS.
  6. Change the settings in the wp-config.php file for DB_NAME, DB_USER, DB_PASSWORD to the new settings created in mySQL.
  7. Open the .sql database file in a text editor and replace all instances of the original URL with the new one, for example replace http://www.mywebsite.com with dev.mywebsite.com.
  8. Import the .sql file into the new database using the mySQL shell.
    1. USE newsite;
    2. source c:/path/to/backupfile.sql

      Thanks for this post for tips on importing on Windows:
      http://philip.yurchuk.com/software/mysql-failed-to-open-file-error-2-and-22-on-windows/

  9. Start the website in IIS and browse to the restored site.
Advertisements