SQL Server to MySQL – Migrating Backup for a WordPress Site

migrationMySQLsql serverWordpress

I have a client with an old .Net site that used SQL Server. For lots of reasons they decided to switch to WordPress. They had a bunch of news articles on that old site that they want turned into posts or custom post types on their new WordPress site (the standard post is probably easier?)

I reached out to their hosting company and got a .bak file of their database and through online research it seems that MySQL workbench is the best route to go as far as getting this file into a MySQL DB. This is where I'm getting stuck. I don't deal with databases a ton besides backing up WordPress MySQL databases to move them during local to production development or changing url structures.

Do I need to upload this file to a server somewhere like my personal production site's server to make this migration happen?

My plan was copy the WordPress site over to my localhost and migrate the SQL Server backup file to my local MAMP server somehow as a test to see if it works correctly. I see this question was sort've asked before but there wasn't a ton of dialogue on that so was hoping anyone with new ideas could help me out since I gave a little more context on my goal. I'm on a mac by the way.

There are 1745 articles with categories and subcategories that won't match the current configuration in the WordPress database. I asked my server side engineer here at work and he said a possible option is to export the database to CSV and use a CSV to WordPress plugin to import it. Does this sound like a possibly easier solution?

Best Answer

Good luck. You'll need to do way more work than just a "restore".

Essentially, you'll need to create a custom pipe to convert the data in the SQL Server database into the table structure used by WordPress.

Even if the table structure was identical, and it isn't, you can't "restore" a .bak file into a MySQL database. The .bak does not contain SQL statements; it is a binary representation, page by page, of the SQL Server database.

Presuming there aren't a huge number of articles, it is generally considered easier to manually transfer them into WordPress using the interface. Welcome to the thrill of vendor lock-in.

If you have access to a SQL Server, you might try restoring the .bak file then exporting the desired data as SQL Statements using the "script database" facility. You might then be able to do a transformation on the SQL Statements to make them "fit" the design of the WordPress database. I'd be very skeptical that this would be easy, however at a certain point this will take less time than manually recreating the stories in WordPress.