Transferring WordPress from Server to Server

Meetup Presentation 08-09-11

Required

  • wp admin access
  • ftp access or control panel access
  • phpmyadmin access or database access
  • Domain Names are all ready in place and pointing in the right direction.

Basic Outline

  1. Download WP
  2. Export SQL
  3. Upload WP
  4. Import SQL
  5. Update DB

Download WP
Download your all files that in the directory where WordPress is located. Most of the time this will be your root directory. Optionally, if you have a control panel like cPanel, you can use compress all the wp-files in to one compressed file to make this process extremely faster and easier.

Download SQL
Export your current database. You may do this from either phpmyadmin or if you do not have access you can use a plugin like WP-DB-Backup.

Upload WP
Upload the your files or your zipped file. If you zipped your file you will need to decompress the file and be sure that the wp-files reside in the directory you intended them to be in.

Import SQL
Access your database via phpmyadmin or another database application. Import the sql file that you exported. If your exported file is a zip be sure to decompress it before uploading.

Update DB
The tricky part. Start by doing a search for the old-domain this will allow you to see exactly how many changes are going to be needed and where they are at.

NOTE: From my experience the method we are using will not work on serialized data so be sure not to run the following script on any row that uses a serialized format to store data.

Here are the two most common sql sting you will need. As a personal note, I NEVER run this type of sql on the options table. I do those manually, typically there are only about 4 values that need changing. Notice that I am only using the bear necessities for the domain name. there is no http:// or training slash. Keep it simple and strait to the point. The only time you may need extra is if you are dealing with an installation that has been placed in a sub/directory.

UPDATE wp_posts SET post_content = replace( post_content, 'old-domain.com', 'new-domain.com' ) ;
UPDATE wp_posts SET guid = replace( guid, 'old-domain.com', 'new-domain.com' );

To perform these lines of sql click on the sql tab of the phpmyadmin and enter these lines into the textarea. Hit Go! The admin will notify you of your updated rows.

I like to keep an ongoing file that holds all the different type of updates I’ve done to make workflow faster. UPDATE sql


You may also be interested in: