Marketing & Sales Videos

WordPress: Backup and Restore to another Server

RepairWhen my site was attacked by comment-spam bots (sounds like science fiction, eh?) this week, I was forced to restart my server quite a few times before thwarting the attack. I actually think that I somehow corrupted the database or a file within WordPress because after the event, the site wouldn’t last more than a few hours or so without going down.

I took advantage of the opportunity to move my site to a new account on my reseller account at Jumpline.com. I’ve been ecstatic with Jumpline over the years. I host about 30 websites and almost never get a call from the clients who host with me (unless they need help). The service is remarkable and their support team is fantastic.

Their support techs were actually the guys who identified that it was some spam-bots that were killing my site (Thanks!). Moving to the new account now puts this site on the latest version of PHP/MySQL and has a really nice Ajax Webmail application.

What I didn’t realize is what an incredible pain it was to try to do a clean installation of WordPress. Many of the plugins out there add fields and tables to your WordPress database. I am constantly evaluating with plugins so my database was a disaster. Executing a WordPress or database backup and restoring it on the new account was probably just going to move the issues with it. At minimum, it was going to throw a bunch of additional fields and tables in there. I’d like to see future versions of WordPress mandate database modifications when deactivating a plugin so the garbage isn’t left behine.

I even looked at some additional plugins that would output your WordPress blog to XML for re-import, but then you lose a lot of data. Twelve hours later (I did sleep) and I think I’ve actually completed moving the account and all of the applicable data, though. It was a bit of a nightmare, but here’s what I did:

  1. Backed up the original site and database.
  2. Installed WordPress from scratch on the new account.
  3. Installed the latest WordPress plugins from scratch on the new account.
  4. Set all of the plugin options and site settings.
  5. Did a table comparison of every table from the source database and the destination database.
  6. Deleted all fields in the source database that did not exist in the destination database.
  7. Emptied all tables in the destination database (ridding yourself of the standard WP test posts.
  8. Did an export of each table without drop and recreate. This will write the records to the new database with the same keys so none of the relationships are broke.
  9. Copied my wp-content\upload folder from the source account to the destination account. Since I moved the domain name as well, all image references were maintained.
  10. I ran the blog and tested it! I did have to clean up some page permalinks, I’m not sure why, but they were okay afterwards.

It’s interesting that WordPress has built-in Imports for competitive blogging platforms, but no import to execute a WordPress to WordPress import that will disregard plugin modifications.

That pretty much did it. You may notice I’m running a new theme. I was simply having too many small issues with the beta theme that I was running. I’ve done some extensive customization of this theme but I think I’ve almost got it where I want it.

My only complaint with the theme is that the author did not implement a common footer throughout the theme that resided above the bottom >body> tag, so I had to manually input my Google Analytics script throughout. I could have built a custom footer and referenced it, but I think later I would have got confused since the theme’s author used the name ‘footer’ on everything. It is a very nice theme, though!

I guess I’m back up now! Now I have to get to work!

3 Comments

  1. 1
  2. 2

    Just a thought…
    I always test back up and restore solutions, your post got my attention.
    Using the built in export and import built in to 2.1 , was a dream. I did have a problem with the displayed graphics.
    I’m about to wipe out and re-start the test blog, but this time I’ll edit the XML file to reflect the new location of the pictures.

  3. 3

    I too had the fine experience of rebuilding my WordPress site from the ground up. All went pretty well as I was sure to backup everything via multiple means.

    The main problems I ran into were my category post assignments were lost due to importing via the XML file. Plus, a few posts weren’t fully restored. It seems like it was due to some problems with the use of single quotes in paragraphs. For some reason, the backup file didn’t properly escape the quotes and WordPress thought it had come to the end of a post.

    Oh well, it took some time but I was able to pull this info from the .SQL file I backed up before deleting the database.

    Thanks for sharing your experiences.

Leave a Reply