WordPress Backup and Migration - Manual Method

These are the procedures for a manual backup of the files and databases that make up a WordPress site. Backup, restore, and migration is done through the cPanel's File Manager. Login there and proceed with the steps below.

You may want to login to the WordPress admin page to check on whether there are any updates or not. If so decide whether to update before or after backup. The safest choice is to do so after the backup in case there is a compatibility issue.

Backup Procedure

  1. Create a folder on your local machine with the name format of: YYYYMMDD-HHMMSS_domain.
  2. If the wp-config.php is outside the public_html folder as is often the case as a security measure then move it back in Or download it and include it at the top level of the archive folder.
  3. Make a .zip of the public_html folder and download.
  4. Export the MySQL database using PHPMySQL. If asked for a username and password use the one's assigned to the database, not the cPanel or WordPress admin.
  5. Put the .zip and the MySQL export into the above folder.
  6. Add in the searchreplacedb.zip.
  7. Compress this folder for archival.

Restore and Migration Procedure

  1. Decompress the public_html.zip and move into place.
  2. Deactivate the .htaccess file by renaming it temporarily. This will disable any hard coded security related directives.
  3. Create the new database and import the data.
  4. If the URL/domain name does not change in the move then simply copy everthing into place.
  5. If the URL/domain name does change then must run the searchreplacedb.php script to update the database. Get the script here: http://www.interconnectit.com/products/search-and-replace-for-wordpress-databases/
  6. Run the script and it will ask for the DB name, User ID, and Password. You can enter new data or existing data. This will be written into the wp-config.php file.
  7. If there is a domain name change as when working on a local server vs. hosted server you will need to do a search and replace against the database. "http://www.olddomain.com" replaced with "http://www.newdomain.com".
  8. Check the wp-config.php file to make sure the new database settings for user and password are correct.
  9. Move the wp-config.php file back outside the public_htme folder if that is where it needs to go.