Converting MS-SQL to MySql (from .bak file or otherwise)

March 17, 2009 – 12:52 pm

What to expect:

Using this methodology, you’ll be able to move table definitions and the data contained within those tables. However, you will NOT move Views, Stored Procedures, Triggers, etc.

Views arrive as simple tables, so be prepared to recreate them by hand. Procedures don’t arrive at all, so same “manuality” applies.

These are the steps to convert an MS-SQL database to MySql:

First, you will need access to a machine that runs MS-SQL, so if all you have is a .bak file, you will first need to restore a database from it within MS-SQL before you can covert it.

(Skip this step if your DB already up  and running).
If you don’t have MS-SQL running on your machine, download SQL Server Management Studio Express, a free tool from Microsoft that allows you to work with MS-SQL databases.
After installing, open the program and see if you can connect to your local machine. In my case I couldn’t becauseI didn’t have all the required services running.

To start the services, go to “Control Panel -> Administrative Tools -> Services” and look for 2 services: “SQL Server”, and “SQL Server Browser”. Start those. Now SQLSMSE should let you connect.

Restore DatabaseTo restore a database from a .bak file, simply right-click on the Databases item in the Object Explorer, select “Restore Database” and follow the directions. Voila, you should end up with a running MS-SQL database.

Now for the actual conversion to MySql:

You will need to have a MySql ODBC connector installed on your machine, which you can get from http://dev.mysql.com/downloads/connector/odbc/5.1.htm
(You don’t have to register to get the driver!)

Once installed, you need to add a new data source to your machine. Go to “Control Panel -> Administrative Tools -> Data Source” and under User DSN click “Add” and select the newly installed MySql ODBC driver. Then point this to the target MySql database (if it doesn’t yet exist, create it first).

Great! So now we have a source database, a target database, and both can transfer data via ODBC. All that’s left to do is fire up the Import / Export Data Wizard that comes with MS-SQL and select the appropriate input/output settings, and convert.


Filed under: Rnadom Sftuf — by Richtermeister

7 Comments »

  1. I”m trying to convert a .bak file to a mysql file but i don’t know how to choose the file

    “To restore a database from a .bak file, simply right-click on the Databases item in the Object Explorer, select “Restore Database” and follow the directions. Voila, you should end up with a running MS-SQL database. ”

    i can only choose between model and msdb and there isn’t a browse file option
    how can i do this

    I hope you can help me

    Comment by Mister S — June 23, 2009 @ 12:17 am

  2. Hey Mister S,

    Thanks for stopping by, let’s see if I can help. I’ve added an image to illustrate which “restore database” option I mean. Are you getting this far? I’m not sure where you’re finding the model vs. msdb option, is that happening in the MS Sql Server Management Studio?

    Comment by Richtermeister — June 23, 2009 @ 6:37 am

  3. How are you?! Please e-mail me your contacts. I have a question james@infansport.ru” rel=”nofollow”>……

    Best regards….

    Trackback by Frankie — June 11, 2010 @ 7:45 pm

  4. Добрый день! thomas@sotkashop.ru” rel=”nofollow”>……

    С уважением,…

    Trackback by Freeman — June 16, 2010 @ 1:45 am


  5. PillSpot.org. Canadian Health&Care.Special Internet Prices.Best quality drugs.No prescription online pharmacy. No prescription pills. Order drugs online

    Buy:Cozaar.Lipothin.Lipitor.SleepWell.Lasix.Aricept.Advair.Wellbutrin SR.Zocor.Female Cialis.Benicar.Seroquel.Prozac.Ventolin.Female Pink Viagra.Nymphomax.Zetia.Amoxicillin.Acomplia.Buspar….

    Trackback by LESLIE — July 15, 2010 @ 11:39 am


  6. Medicamentspot.com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. High quality drugs. Buy pills online

    Buy:Viagra Super Force.Cialis Super Active+.VPXL.Levitra.Super Active ED Pack.Soma.Viagra Soft Tabs.Zithromax.Cialis.Tramadol.Cialis Professional.Viagra Professional.Maxaman.Viagra.Propecia.Cialis Soft Tabs.Viagra Super Active+….

    Trackback by JULIO — July 21, 2010 @ 4:58 am

  7. Baseboard http://arockab-pb.03GMCPARTS.US/tag/Problems+Baseboard+Hot/ : Baseboard…

    Problems…

    Trackback by Hot — August 29, 2010 @ 6:52 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress