Table of Content
    Database Converter

    How to Convert MSSQL into MySQL?

    Table of Content

      Summary: There are various reasons that compel the organizations to convert MS SQL database into MySQL. In this post, we will see how to convert data from MS SQL into MySQL database. We will also mention a powerful database conversion software that can convert MS SQL database into MySQL in a few simple steps.

      Microsoft SQL Server and MySQL are among the best relational database management systems (RDBMS) but with one important difference. MS SQL is a proprietary software of Microsoft while Oracle MySQL is open-source and free. This is one of the reasons why companies migrate to MySQL to manage their data. Another important reason that drives the companies to migrate to MySQL is the cost. To be brief, looking at the top editions of these two DBMS, the Enterprise edition of Microsoft SQL Server costs more than the same edition of MySQL.

      The migration process, however, is an important process that must be analyzed and planned properly. For example, an aspect to keep in mind is that the data types used by the DBMS may differ. In addition, this process involves not only data but also all the other objects, such as functions, procedures, etc.

      Ways to Convert MS SQL to MySQL

      There are different ways to convert or migrate data from MS SQL to MySQL.

      Convert MS SQL to MySQL Manually

      Data types in Microsoft SQL Server and MySQL are sometimes different. So, to avoid errors or loss of data, mapping between data types must be done. You can refer the official document to know the data type mapping between these two DBMS. For example, Varchar and NVarchar MS SQL data types can become a TEXT data type depending on the field length in MS SQL.  

      Adding data types in MSSQL

      The first step is to convert the database schema using the correct data types. You also need to consider other aspects, such as whether the field you are considering accepts NULL values and the field has a primary key.

      Since both RDMS adhere to and support much of the ANSI ISO standard, when you create the tables using the SQL “CREATE TABLE” command, the syntax will be similar.

      For example, below is the schema of the table ‘Customer’ in MS SQL Server.

      Creating Database using MSSQL

      Below is the schema of the same table in MySQL.

      Creating Database using MYSQL

      You can observe that:

      • The Char data type became a Varchar.
      • The NVarchar data type became a Varchar too.
      • The syntax of the command is slightly different.

      You need to prepare a script to create all the tables you want to migrate and then run the script from the MySQL Console or MySQL Workbench.

      Once the schema is migrated, you can migrate the data. You can do this operation by creating a script that contains a list of “insert into values” statements.

      Adding Insert Into Query

      Convert MS SQL to MySQL using MySQL Workbench Migration Wizard

      Manual conversion is an intense task, since a database can contain thousands of tables. For this reason, a dedicated data migration tool is very useful. You can use the MySQL workbench migration wizard. Follow these steps to use MySQL Workbench:

      • Open MySQL Workbench and go to Database > Migration Wizard.
      Moving to Migration Wizard from Database
      • A window will open asking you to install an ODBC driver. To open the ODBC manager, just click on the “Open ODBC Administrator” button.
      Overview of MySQL Workbench Migration Wizard
      • You can install the following Microsoft SQL Server driver (see image).
      Installation of SQL server driver
      • After that, press the Start Migration button.
      • Enter the following source connection parameters:
      • Database system must be set to Microsoft SQL Server.
      • Connection Method must be set to ODBC (native).
      • Enter the name of the server and the password.
      • Press the Test Connection button to test if the connection is working.
      • Press the Next button to setup the destination.
      Source Selection for MSSQL server
      • In the target connection, set the stored connection to the local instance of MySQL.
      • Then, enter the username and password, and press the “Test Connection” button to test if the connection is working.
      • Now, press the Next button.
      Adding Parameters for Target Selection of MYSQL
      • A list of objects of MS SQL is fetched. Press the Next button.
      Fetching Schemas list with different logs
      • A list of SQL Server databases is shown. Check the database you want to migrate, choose a Schema Name Mapping Method, and then press the Next button.
      Including Schema for migrating Schema selection
      • Each SQL Server table is retrieved.
      Reverse Engineering Source Completion
      • You can choose the table you want to convert or convert all the tables.
      Source Objection for Migration
      • The migration of the table schema begins.
      Migrating different tasks for MYSQL objects
      • You can edit and review the migrated objects.
      Manual Editing for migration
      • Choose your target creation options and press the Next button.
      Creating Schemas in target RDBMS
      Creating Schemas by performing tasks
      • The SQL scripts generated to create table in MySQL will be executed.
      • You can see the details of the process of the schema creation.
      Adding Object for Creating target results
      • By default, data is copied online to the MySQL database.
      Online copy for Data Transfer Setup
      • Data transfer from MS SQL to MySQL.
      Tasks for Bulk Data Transfer
      • At the end of the migration, a detailed report is shown.
      Migration Report Review

      MySQL Workbench Migration Wizard is a good instrument to convert MS SQL to MySQL. However, it has some limitations, such as:

      • Setting up the conversion of schema and data takes a long time.
      • You need technical skills on both MySQL and MS SQL DBMS.
      • To perform migration, you need to have installed both MS SQL and MySQL DBMS.
      • You can perform migration only on live databases.

      Convert MS SQL to MySQL using Stellar Converter for Database

      To overcome the limitations of the above methods, you can use a dedicated database conversion tool, such as Stellar Converter for Databases. This tool allows you to convert MS SQL database records into MySQL database format in a few simple steps. Another advantage of this tool is that only the target DBMS (MySQL) needs to be installed. Also, you can migrate live or offline databases.

      Let’s see how to convert MS SQL database into MySQL with Stellar Converter for Database.

      • When the tool starts, it asks for a database to be converted.
      • In the Source Database, select the MS SQL option.
      • Then, choose if you want to perform an offline or a live conversion. Press the Scan button.
      Selecting Database using Scan
      • At the end of the scan operation, a dialog box appears showing the scan complete message. Press the OK button.
      Scanning completed with tool
      • A preview of the data is shown. So, you can perform a check.
      Preview of Data with the Converter tool
      • Press the Convert button to convert the scanned data.
      Clicking on Convert button for the scanned data
      • In the “Convert and Save Database” dialog box, choose MySQL as Database Type.
      • Enter the username, the host name, and the password. Then, press the Save button.
      Converting and Saving the database
      • After the conversion process, a process complete message appears.
      Processing the Databases successfully.

      To Conclude

      Above, we have discussed different ways to convert the MS SQL database into a MySQL database. You can perform the conversion manually or use the Migration Wizard feature of the MySQL Workbench. However, these methods have some limitations. For a quick and easy migration process, you can use a powerful database conversion software, such as Stellar Converter for Database.

      Was this article helpful?

      No NO

      About The Author

      Bharat Bhushan linkdin

      Bharat Bhushan is an experienced technical Marketer working at Stellar Data Recovery - expertise in data care. He is skilled in Microsoft Exchange Database, MSSQL Database troubleshooting & data warehousing. He is a Management Post Graduate having a strong grip in Technology & certified in SAP-SD, Oracle 10g & Informatica Powercenter 9.1.

      Related Posts


      Why Choose Stellar?

      • 0M+


      • 0+

        Years of Excellence

      • 0+

        R&D Engineers

      • 0+


      • 0+


      • 0+

        Awards Received