How to export data from SQL Server 2005 to MySQL

96,321

Solution 1

The best way that I have found is the MySQL Migration Toolkit provided by MySQL. I have used it successfully for some large migration projects.

Solution 2

SQL Server 2005 "Standard", "Developer" and "Enterprise" editions have SSIS, which replaced DTS from SQL server 2000. SSIS has a built-in connection to its own DB, and you can find a connection that someone else has written for MySQL. Here is one example. Once you have your connections, you should be able to create an SSIS package that moves data between the two.

I ddin't have to move data from SQLServer to MySQL, but I imagine that once the MySQL connection is installed, it works the same as moving data between two SQLServer DBs, which is pretty straight forward.

Solution 3

Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question).

If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I would recommend using PHP 5.2+ and the PDO libraries. You'll be able to connect using PDO ODBC (and use MSSQL drivers). I had a lot of problems getting large text fields and multi-byte characters from MSSQL into PHP using other libraries.

Solution 4

Another tool to try would be the SQLMaestro suite. It is a little tricky nailing down the precise tool, but they have a variety of tools, both free and for purchase that handle a wide variety of tasks for multiple database platforms. I'd suggest trying the Data Wizard tool first for MySQL, since I believe that will have the proper "import" tool you need.

Share:
96,321
Mat
Author by

Mat

Updated on July 08, 2022

Comments

  • Mat
    Mat almost 2 years

    I've been banging my head against SQL Server 2005 trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with any row that has a string with a comma in it (or whatever you use as a delimiter) and I would still have to hand write all of the create table statements, as obviously CSV doesn't tell you anything about the data types.

    What would be better is if there was some tool that could connect to both SQL Server and MySQL, then do a copy. You lose views, stored procedures, trigger, etc, but it isn't hard to copy a table that only uses base types from one DB to another... is it?

    Does anybody know of such a tool? I don't mind how many assumptions it makes or what simplifications occur, as long as it supports integer, float, datetime and string. I have to do a lot of pruning, normalising, etc. anyway so I don't care about keeping keys, relationships or anything like that, but I need the initial set of data in fast!

  • Mark Robinson
    Mark Robinson about 14 years
    +1 - It is now EOL, and MySQL Workbench is going to include a migration plugin (past version 5.2) but for now use the following link: dev.mysql.com/downloads/gui-tools/5.0.html
  • Robert Ivanc
    Robert Ivanc almost 14 years
    doesn't want to convert DATE or DATETIME columns :(
  • mkirk
    mkirk about 13 years
    Note: Currently, the MySQL Migration Toolkit is not available for Linux (from dev.mysql.com/doc/migration-toolkit/en/…)
  • casterle
    casterle over 12 years
    Note that the My SQL Migration Toolkit requires the 32-bit version of JDK 5 update 8 or later (must be ver 5, ver 6 won't work), which you can download here: tinyurl.com/5snd6y3