How to import a SQL Server .bak file into MySQL?

前端 未结 10 614
天涯浪人
天涯浪人 2020-12-02 04:52

The title is self explanatory. Is there a way of directly doing such kind of importing?

相关标签:
10条回答
  • 2020-12-02 05:48

    For those attempting Richard's solution above, here are some additional information that might help navigate common errors:

    1) When running restore filelistonly you may get Operating system error 5(Access is denied). If that's the case, open SQL Server Configuration Manager and change the login for SQLEXPRESS to a user that has local write privileges.

    2) @"This will list the contents of the backup - what you need is the first fields that tell you the logical names" - if your file lists more than two headers you will need to also account for what to do with those files in the RESTORE DATABASE command. If you don't indicate what to do with files beyond the database and the log, the system will apparently try to use the attributes listed in the .bak file. Restoring a file from someone else's environment will produce a 'The path has invalid attributes. It needs to be a directory' (as the path in question doesn't exist on your machine). Simply providing a MOVE statement resolves this problem.

    In my case there was a third FTData type file. The MOVE command I added:

    MOVE 'mydbName_log' TO 'c:\temp\mydbName_data.ldf',
    MOVE 'sysft_...' TO 'c:\temp\other';
    

    in my case I actually had to make a new directory for the third file. Initially I tried to send it to the same folder as the .mdf file but that produced a 'failed to initialize correctly' error on the third FTData file when I executed the restore.

    0 讨论(0)
  • 2020-12-02 05:51

    In this problem, the answer is not updated in a timely. So it's happy to say that in 2020 Migrating to MsSQL into MySQL is that much easy. An online converter like RebaseData will do your job with one click. You can just upload your .bak file which is from MsSQL and convert it into .sql format which is readable to MySQL.

    Additional note: This can not only convert your .bak files but also this site is for all types of Database migrations that you want.

    0 讨论(0)
  • 2020-12-02 05:51

    The .bak file from SQL Server is specific to that database dialect, and not compatible with MySQL.

    Try using etlalchemy to migrate your SQL Server database into MySQL. It is an open-sourced tool that I created to facilitate easy migrations between different RDBMS's.

    Quick installation and examples are provided here on the github page, and a more detailed explanation of the project's origins can be found here.

    0 讨论(0)
  • 2020-12-02 05:51

    SQL Server databases are very Microsoft proprietary. Two options I can think of are:

    1. Dump the database in CSV, XML or similar format that you'd then load into MySQL.

    2. Setup ODBC connection to MySQL and then using DTS transport the data. As Charles Graham has suggested, you may need to build the tables before doing this. But that's as easy as a cut and paste from SQL Enterprise Manager windows to the corresponding MySQL window.

    0 讨论(0)
提交回复
热议问题