I facilitate several WordPress blogs, several of which I installed on DiscountASP.NET. I wrote a blog about the process, and then as now it felt like I had to shoehorn WordPress onto their system. I, as well as others, began to have problems administrating our blogs (notably, difficulties adding plugins or upgrading versions).
Iâ€™ve also hosted a number of domains with Applied Innovations, and I knew they added some new capabilities and a crazy new plan for Webmatrix hosting, especially ensuring the right capabilities for WordPress and other WAMP stack applications (such as Joomla, Drupal, and so on). Better pricing and the right features-it was time to migrate.
I migrated two blogs today using the steps below, and Iâ€™m going to migrate a couple others as their current hosting nears expiration. Moving a WordPress blog involves moving both files and a database; each has its own method.
There are a number of ways to backup and restore a WordPress blog. The official documentation is http://codex.wordpress.org/WordPress_Backups and http://codex.wordpress.org/Restoring_Your_Database_From_Backup. There are several plugins you can install which will backup your blog on a scheduleâ€”itâ€™s not a bad idea to use these. I think the method below is pretty easy and effective for a migration, but isnâ€™t necessarily a process you want to repeat every week as part of a regular backup (unless you script it, which is possible).
Step 0: Get The Tools
I used two tools to migrate my blogsâ€”FileZilla, to transfer the files, and MySQL Workbench to migrate the databases. Both are free and widely available.
Step 1: Prepare Your New Host
Before you do anything, make sure your new hosting is set up, that you can log into your control panel, and you have both a new website and database set up. On some hosts (such as AppliedI), the FTP login is the root folder, but the WWW service points to s subfolerâ€”make sure you know where to put the files. Keep track of your passwords!
Step 2: Clean Up Any Messes
Migration will involve exporting data from your current blogâ€™s database, then importing all of it again into your new blogâ€™s database. This process, on both ends, can take some time, so obviously the less data you try and move the easier it will become. This is the time to log in to your control panel, empty all the spammy and trashed comments, clear out posts which havenâ€™t been published if you donâ€™t plan on finishing them, etc. Also, if you have any custom DNS entries made on your current hostâ€™s nameservers, such as redirecting email to GMail or Hotmail, copy those settings.
Step 3: Download The Blog Files
Log in to your current blog, and download all the files. Youâ€™ll need everything in your blog root, as well as the three subfolders (wp-admin, wp-content and wp-includes). Download these to your local machine, because youâ€™ll need to edit one of them. Donâ€™t delete anything from your current site, just in case you need something again.
Step 4: Export Your Blogâ€™s Data
This step requires the most explanation. Itâ€™s not difficult, there are just a number of small things which need to be done.
Start up MySQL Workbench; the Workspace area is divided into three columns, the far right of which is Server Administration. Below this listbox, click New Server Instance.
Choose the Remote Host option, and enter the name of your current blogâ€™s MySQL Server, then click Next.
Give this connection a better name in the Connection Name box; this will populate a connection in the SQL Development column. Change the Username if necessary (it probably is). If you want/can store the password in MySQL Workbench, click the Store in Vault button next to Password, and enter the password in the dialog. If you donâ€™t store the password, youâ€™ll be prompted when you try to connect. If you need to, adjust other settings, but you probably wonâ€™t need to. Click Next.
The database connection settings will be tested. If Workbench cannot connect, youâ€™ll need to fix whatever is wrong before you can continue. Click Next once everything is OK.
Remote management takes some additional configuration, and itâ€™s not something weâ€™re going to do here. If you want to use MqSQL Workbench to manage your database, you can set this up, but itâ€™s not necessary to export/import data.
A bunch of intermediate steps will be skipped, and we then assign a useful name to the new Instance. Clicking Finish here will close the wizard and create the connection and the instance.
Select the new instance with a single click, then choose to Manage Import/Export.
You may be prompted to choose the connection.
This is the most important set of our export. Select your database with a single click, then choose which items correspond to your blog. In a WordPress database, there are only tables, and by default they are prefaced with â€œwp_â€. The image below shows a default install, for reference. To make the import easier, choose to Export to a Self-Contained file. For most blogs, this will be OK, but for very large blogs, you can choose to export individual tables into separate files.
The export will take a few minutesâ€”watch the progress indicator. When complete, you can close the Import/Export window. We need to make a couple small edits to the export file before we can use it. If you exported to multiple files, youâ€™ll need to make this change to all of them.
About 22 lines down is the command to create a database if it doesnâ€™t exist. Since our user probably doesnâ€™t have the correct permissions to do this, we need to commend this out by adding two dashes and a space at the beginning of the line (the space is necessary). A couple lines further down is the USE directive. This needs to be changed to the name of our new blog database.
Step 5: Import Your Blogâ€™s Data
If you havenâ€™t done so already, make sure your new blog database is set up, and has a login user ID created.
Back in MySQL Workbench, under the SQL Development column, click the New Connection link.
Just as before, give this connection a useful name, then update the Hostname and Username (if necessary). Again, if you want/can store your password in the vault, do so. Once everything is correct, click OK.
When all is well, weâ€™ll have a new entry in the Connections listbox. Double-click the new blog entry to open the SQL Editor.
In the SQL Editor, open the dump file you created above, double-check you made the minor (but important) edit above, and run the script. The tables should be created and populated. If you dumped to multiple files, youâ€™ll need to repeat this process for every file. When all the scripts have been run, you can expand Schemas >> [your database] >> Tables and see the WordPress tables. If youâ€™re familiar with SQL, you can query some data at this point, too.
Step 6: Upload Blog Files (edit the config first!)
Before we do anything, we need to modify the database connections in our downloaded wp-config.php to point to our new hostâ€™s database and server. These are the first four settings in the file.
Save this file, and upload all the files to the new host. Make sure youâ€™re in the right folder, whether itâ€™s the root or a subfolder. Once this is complete, you should be able to view your blog through a temporary URL, or your actual URL, depending on how your site is configured at this time.
Step 7: Update Nameservers
Since youâ€™ve moved to a new host, itâ€™s now time to update the nameservers for your domain. This is now a good time to download any email you want to keep from your hostâ€™s email system. Youâ€™ll probably need to update your email clients, too.
Congrats! You should soon have your blog completely set up on your new hosting service. Remember to cancel your old service!