Import MSSQL bak files to MySQL

Are you a web developer or a system admin that is used to work with MySQL, but for a specific project you are provided with a MSSQL BAK file? If the MSSQL BAK file is no bigger than 10 GB, you are lucky: you can import MSSQL bak files to MySQL without paying for a licence of MS SQL as you can use “MS SQL Server Express Edition”.

Prerequisites
To import MSSQL bak files to MySQL you need:

Beside the computer, that you may already have, all programs are free.

How to import MSSQL bak files to MySQL

  1. Once you have installed all the prerequisite programs, place the MSSQL bak file you want to import to MySQL in “C:\Program Files\ Microsoft SQL Server\ MSSQL12.SQLEXPRESS\MSSQL\ Backup”;
  2. Open “SQL Server 2014 Management Studio”;Import MSSQL bak files to MySQL - part 01
  3. Remove any previous import of database (it may exist if you regularly have to import MSSQL bak files to MySQL);
  4. On the list on the left, click the right button on Database and select “Restore Database”;Import MSSQL bak files to MySQL - part 02
  5. Choose “Device”;
  6. click on the 3 dots (…), select “Add”, choose the bak file of point 1 and click “OK;Import MSSQL bak files to MySQL - part 03
  7. In the “Destination” to choose the name you want to give to the database and click “OK” – now the bak file is being imported on MSSQL;Import MSSQL bak files to MySQL - part 04
  8. Once you finish the import, open MySQL Workbench;Import MSSQL bak files to MySQL - part 05
  9. Click on “Database Migration” and then “Start Migration” (bottom);Import MSSQL bak files to MySQL - part 06
  10. As “Database System” select “Microsoft SQL Server” – as “Connection Method” choose “ODBC (native)” – leave “User Name” empty – choose “Next”;Import MSSQL bak files to MySQL - part 07
  11. As “Target RDBMS” put the information of your MySQL server and click “Next”;Import MSSQL bak files to MySQL - part 08
  12. If the screen does not give any errors click “Next”;
  13. Select the database and the subheading and click “Next”;Import MSSQL bak files to MySQL - part 09
  14. If the screen does not give any errors, click “Next”;Import MSSQL bak files to MySQL - part 10
  15. Select “Migrate Table objects” and click “Next”;
  16. If the next two screens do not give any errors, click “Next”;Import MSSQL bak files to MySQL - part 11Import MSSQL bak files to MySQL - part 13
  17. Choose “Create in target RDBMS schema” and, if later on you want to do the real import on a production MySQL server, “Create a SQL script file” and click “Next”;
  18. If you receive a notice that the database on MySQl need to be emptied, click “Yes” (unless you want it to hold in this case to say “No” and make a backup before repeating the procedure “;
  19. If the next two screens do not give errors click “Next”;
  20. Unless you do not want to change the parameters of “Data Copy”, click “Next”;
  21. In the “Bulk Data Transfer” you can see the import progress and when finished, click “Next”;
  22. You will see a final view of the report; click “Finish”.

Import MSSQL bak files to MySQL - part 13

Now you have the MSSQL bak files regularly imported on your MySQL server and eventually, if you have chosen so on point #17, a sql file to replicate the import on another MySQL server without repeating all the procedure.
Personally I repeated the procedure many times without issues so I cannot predict any problem; if you encounter some, please leave a note on the comments and I will gladly help you.