Convert SQL Server to MySQL.

Migrating from proprietary database engines into open-source engines is a growing trend in the industry. One of the most popular cases is to convert databases from SQL Server into MySQL.

Why migrate from SQL Server to MySQL?

Directly comparing SQL Server and MySQL is difficult, although you often hear ones who claim that SQL Server is better than MySQL or vice-versa.

Comparing them, especially in terms of their performance, is very subjective. Choosing between these databases should depend on developer or DBA experience and architectural or implementation requirements. You can use either of these products to build highly reliable and efficient systems. MS SQL Server and MySQL have their advantages over each other.

  • Usually, the first reason to migrate from SQL Server to MySQL is the cost.

    Microsoft has SQL Server Express edition, which is free. But it has a 10 GB maximum database size and other essential limits.

    This fact prevents SQL Server free version from being used in production.

    The MySQL community edition is free and has no limitations.

  • MySQL historically is cross-platformed. It runs on virtually all platforms, including UNIX, Linux, Windows, and macOS.

    Initially, MSSQL Server, as a proprietary database, supported Windows Operating systems only. But starting from SQL Server 2019, it can also be run on Linux and from Docker container.

However, migrating data between heterogeneous databases is not straightforward. It is not something to be taken lightly.

Datatypes Require Conversion

Data types in MySQL and SQL Server are alike but not the same.

The following table shows SQL Server data types that don’t map in 1-to-1 relationship to MySQL:

SQL Server MySQL
IDENTITY AUTO_INCREMENT
NTEXT, NATIONAL TEXT TEXT CHARACTER SET UTF8
SMALLDATETIME DATETIME
MONEY DECIMAL(19,4)
SMALL MONEY DECIMAL(10,4)
UNIQUEIDENTIFIER BINARY(16)
SYSNAME CHAR(256)

Our Types Mapping feature assists in matching target MySQL data types with their closest and relative MS SQL Server equivalent.

Find more information about mapping between MySQL and SQL Server

SQL Syntax is not the same.

While both SQL Server and MySQL are SQL based Databases, their SQL language syntax differs considerably. So valid SQL Server statements fail when executed against MySQL database.

For instance, look at the following example:

SQL Server MySQL
SELECT TOP 3 WITH TIES *
FROM car
ORDER BY price ASC
                
SELECT price
FROM car
ORDER BY price ASC
LIMIT 3                    
                

Six reasons for using DBConvert/ DBSync to convert data from SQL Server to MySQL?

MySQL Workbench serves data migration tasks from various databases to MySQL. But conversion from a database to MySQL is possible in ONE direction only.

As an alternative to MySQL Workbench, we offer DBConvert products that migrate and sync data from SQL Server to MySQL.

  1. In any combination, data migrations between the following databases are possible:

    • Microsoft SQL Server,
    • MariaDB,
    • Percona,
    • Windows Azure SQL Databases/ Azure SQL Data Warehouse,
    • AWS RDS/ Aurora,
    • SQL Cloud for SQL Server.

    Please refer to the list of available conversion and sync directions in product info cards on the right.

  2. DBConvert tool minimizes the challenges mentioned above you can meet when migrating from SQL Server to MySQL. Your database schemas, tables, views, and relations will be migrated accurately and rapidly according to the target database's requirements, preserving database consistency.
  3. You don't need to know how to write scripts to convert views from MS SQL to MySQL. DBConvert does that for you automatically.
  4. DBSync software keeps your databases in Sync with Update, Insert, and Drop synchronization features.
  5. Bi-directional synchronization helps to update data in both source and destination databases simultaneously.
  6. Trigger-based Synchronization algorithm is developed for accurate analysis of the destination database data and instantly tracking changes in both databases. Trigger-based sync method increases recurrent synchronization speed in times.
  7. Move data directly from SQL Server to MySQL or take advantage of Dump files and PHP scripts, when you don't have direct access to a target database server.
 DBConvert for MSSQL & MySQL

Migration directions:

  • SQL Server → MySQL | MariaDB | Percona
  • MySQL | MariaDB | Percona → SQL Server
  • SQL Servet ↔ Azure Database for MySQL
  • SQL Azure ↔ MySQL | MariaDB | Percona | SQL Server
  • SQL Server ↔ Amazon RDS | Aurora ↔ MySQL
  • ☑ Views conversion between SQL Server and MySQL/ MariaDB
  • SQL Server ↔ Google Cloud ↔ MySQL
  • MSSQL ↔ MySQL Dump, PHP Script
  • MySQL ↔ SQL Azure, SQL Server Dump

Version: 4.2.7

Release Date: Oct. 3, 2018

 DBSync for MSSQL & MySQL

Sync directions:

  • SQL Server ↔ MySQL ↔ MariaDB | Percona
  • MySQL ↔ SQL Azure | Aurora ↔ MariaDB
  • SQL Server ↔ Amazon RDS | Aurora ↔ MySQL
  • SQL Server ↔ Google Cloud ↔ MySQL

Version: 5.4.3

Release Date: Oct. 3, 2018

Try All-in-one DB migration and Sync software.

DBConvert Studio

 Version: 1.8

Release Date: Aug. 4, 2020

Supported databases:

  • SQL Server
  • MySQL
  • Oracle
  • PostgreSQL
  • Access
  • FoxPro
  • SQLite
  • Firebird
  • Excel
  • IBM DB2
  • Azure SQL
  • Amazon RDS
  • Amazon Aurora
  • Heroku Postgres
  • Google Cloud

Using SQL Server to MySQL conversion and synchronization tools.

When you start DBConvert or DBSync application in GUI mode it guides you through several steps to set up the database migration or synchronization:

1. Connect to SQL Server source database.

If a source database requires you to log in, you can specify a user name/ password and host/ port parameters.

Connect to SQL Server source database from DBConvert

2. Connect to MySQL destination database.

Specifying parameters for destination database looks like the same as for source. Usually, it consists of defining connection settings and username/password pairs.

Connect to MySQL target database from DBConvert

NOTE #1: Every DBConvert or DBSync tool has two different databases in its name. That means any specified database from a pair can be set up as a source or destination. Besides, the same type of database may be set up both as a source or destination.

As an example, here is the list of possible migration directions with on-premises databases:

  • SQL Server to MySQL
  • MySQL to SQL Server
  • SQL Server to SQL Server
  • MySQL to MySQL

NOTE #2: Don't be confused by the fact that connections to cloud databases like Amazon RDS, Microsoft Azure SQL, Google Cloud, and Heroku are not explicitly specified in the configuration of a source or destination in the DBConvert / DBSync interface. To connect to Cloud database instances, use the same settings as you do for traditional on-premises databases.

NOTE #3: Your connections to source and target databases stay active until you close DBConvert/ DBSync application or reopen new connections on "source" and "destination" steps.

Read more about the specific source/ destination configurations for different databases.

3. Custoimzation and configuration.

At the next step, you can specify precisely which tables, fields, indices, views you want to transfer to the MySQL destination database. Just check/ uncheck the box in front of each database object you want to convert.

Customize general database/ tables settings. Or set up a particular table , field, index individually when migrating data from SQL Server to MySQL.

Check out our articles about Custoimzation and configuration. for detailed information.

The screenshot below sums up general features available in DBConvert software solutions.

4. Detection of potential database migration issues. Errors and Warnings

The database typically constrains certain relations on the data that cannot be violated. On the customization step, a smart error checker verifies all possible Data integrity and Referential integrity issues and highlights them, if any, before performing a migration.

DBConvert software to default tries to automatically map database types from the source SQL Server database to the closest equivalent of the target MySQL database types. But you can manually change data types for the whole database globally with "Global mapping" or individually for each field.

Check out Smart error checker. Errors and Warnings for more information.

5. Execution. The final stage of data migration from SQL Server to MySQL

Once you configure source and destination databases for migration in the previous steps, you can start the actual conversion or synchronization process.

Click the "Commit" button to start conversion. Also, here, you can monitor the migtation/ synchronization process.

Optionally save connection settings and configuration parameters into the session file to schedule the launching of sync or migration jobs regularly.

Execution step of DBConvert products

Read more about execution stage available options.

Command line mode

Previously saved sessions can be passed as parameters to Command-Line DBConvert Client. A session keeps SQL Server source and MySQL target database connection settings with other specified options.

Example: C:\Program Files\DBConvert\mssql2mysqlPro\mssql2mysqlPro_Cons.exe /Session:"Session_Name"

NOTE: First, you have to run the software in GUI mode to create a session file with initial parameters.

Built-in scheduler.

Our applications come with a built-in scheduler to run database migration and sync jobs at specified times. Just set the scheduled date and time to execute job sessions automatically.

DBConvert screenshot

Highlights

Requirements

  • Necessary privileges to write into database on the target SQL Server (this requirement is optional as there is an option to overcome the restrictions using dump file)
  • Necessary privileges to write into database on the target MySQL server (this requirement is optional as there is an option to overcome the restrictions using dump file or PHP Script)