If you’re currently a WordPress user, there’s a 99.9999% chance you’re running on MySQL, even though you may be running PHP on Windows. Luckily, migrating your WordPress site to SQL Server or SQL Azure should only take a few hours. Here are the steps involved:
A Case Study
My first experience doing a migration from MySQL to SQL Server or SQL Azure was for the Remix Russia keynote delivered by Eric Rudder. Now, I’m in the process of migrating my own WordPress blog (which I’ve been running on a shared LAMP hosting account for years) to Windows and SQL Server.
In this article, I’ll take you through the process.
Let’s get this party started.
First, we need to get a default instance of WordPress running on SQL Server stood up; then we’ll go through the steps of customization. Check out the Getting Started page and the Installing WordPress on SQL Server article to get the default instance up.
Once you’ve completed this step, your site should look something like this:
I didn’t have to do anything special to get this running on my Discount ASP hosting account. I just created the database, FTP’d the files and ran through the standard WordPress install.
Make sure to update the Settings in the WordPress admin for things like Permalinks, Tagline, etc.
The first step in migrating themes is to copy the wp-content/themes folder to your new site via FTP.
How difficult it is to migrate your Theme depends on how it’s built. I’m using a theme that stores its settings within the wp_options table, so I needed to migrate the settings by hand.
To do this,we need to go into Appearance and Activate our theme.
In order to migrate the theme settings manually,open up the Theme options on your current site in the left window and the settings on the new SQL Server site in the right window. It’s a piece of cake to run through these and move over the settings.
Your new site should start to take shape.
Migrating Plugins and Widgets might take a bit of work. WordPress stores the settings for these within the wp_options table, and because we’re migrating our blog over by standing up a new instance, we’ll need to migrate Plugin and Widget settings manually.
NOTE: Plugins and Widgets are an area for potential incompatibility with WordPress on SQL Server. This patch works by intercepting the MySQL statements and converting them to be TSQL compatible with SQL Server/SQL Azure. You can read this article for more architecture details if you’re interested. OmniTI does a great job making sure this works for the core WordPress operations, which should cover the majority of database operations a plugin attempts to execute. There are two scenarios where the database abstraction layer may not work correctly: Either the SQL Server patch just hasn’t been built to handle a certain database statement or the plugin is written incorrectly and accesses the database directly instead of using the WordPress database execution functions. The main point is that once you’ve migrated over your Plugins and Widgets, be sure to do some testing before moving your WordPress on SQL Server site into production.
First, make sure you have already copied over the wp-content/plugins folder to your WordPress on SQL Server site.
Open the Plugins section of your WordPress admin for your current site and the new site side-by-side. Then go through and activate the Plugins you want to continue using.
Make sure to configure the Plugins that require additional steps. For example, you’ll need to copy your Akismet API Key, etc.
Migrating Widgets uses the same process as Plugins: Just open the WordPress admin side-by-side and migrate necessary settings.
Now your site should be ready for content.
Migrating your content with WordPress is straightforward, thanks to the Import/Export feature built into WordPress. The first step is to export your content from your current site using the Export feature under the Tools menu in the WordPress admin.
This will generate an XML file containing all of your Pages, Posts, Comments, Custom Fields, Categories and Tags.
Now, all you need to do is switch to your new WordPress on SQL Server site and use the Import feature under the Tools menu. Make sure to select a WordPress Import.
Now just browse to the XML export from the step above and click Upload file and import.
Now WordPress will parse the XML file and ask you for a couple more details. You can decide to either create new users or map to existing users. You’ll probably want to select the Import Attachments option.
Once the import is complete, WordPress will provide a log of the results.
If you selected to Import Attachments above,WordPress will pull images, etc. into Media for your new WordPress site. Alternatively, you could copy over the wp-content/uploads folder.
Now that your Pages and Posts are in your WordPress on SQL Server site, you may need to tweak some UI elements. For example, I needed to add the Pages and Categories to the header navigation.
Your site should now run WordPress on SQL Server!
The only thing left to do is update the DNS settings to point to my new host.
I spent some time researching a “better” way to do a WordPress migration but I believe that when moving to a different database platform, going through the steps in this article is probably a good idea. If you have alternate suggestions, please let me know.
I’m really excited to be running WordPress on SQL Server. Give it a try and let us know if there’s anything we can do to help!