How to transfer data from Microsoft SQL Server to a MySQL database

Akademily
4 min readSep 9, 2020
How to transfer data from Microsoft SQL Server to a MySQL database

If you mainly use open-source programs in your company, and there are several MS SQL server databases, you can consider moving to a MySQL database.

Below are a few reasons why you might want to consider migrating Microsoft SQL Server to a MySQL database:

  • In order to avoid huge licenses and support for MS SQL Server. In MySQL, even if you decide to use the corporate version of MySQL, it is cheaper.
  • Unlike SQL Server, MySQL supports a wide range of operating systems, including several Linux, Solaris, and Mac distributions.
  • To implement a scalable database infrastructure.
  • In order to take advantage of several additional features of a MySQL database, which have been tested over many years by a huge open source.

MOVE AN MS SQL DATABASE TO MYSQL USING THE “MYSQL WORKBENCH” UTILITY MODULE

The easiest way to install MySQL Workbench is to install “Oracle MySQL for Windows”, which installs several MySQL tools including Workbench.

Download and install the MySQL Installer, which includes the Workbench and other necessary modules and drivers you need for migration.

The steps required to migrate an MSSQL database to MySQL using the Workbench Migration Wizard

1. Take care of the necessary conditions

Before running the MySQL database migration wizard in the toolbox, we need to make sure that ODBC drivers are present to connect to the original Microsoft SQL Server database as they are not supplied with the Workbench.

Make sure that the max_allowed_packet option in MySQL Server is large enough for the migration.

Make sure that we can connect to both the target MySQL server database and the source MSSQL Server database with the appropriate privileges that are necessary for the data migration.

In the MySQL Workbench, the Migration Wizard will display the following “Migration task list” that you need to go through to finish the migration process.

2. Selecting the source and target database

First, define the connection options for the initial Microsoft SQL Server database. Select “Microsoft SQL Server” from the drop-down list of database systems. On the Options tab, select DSN and specify the user name in the database.

Next, define a target connection to a MySQL database in the Options tab. Select “Local MySQL instance” or “Remote MySQL instance” depending on the situation.

On the Options tab, enter the hostname or IP address of the MySQL database, MySQL port, and user name. If you do not specify a password, he will offer you.

After you specify the source and destination, all available schemes and databases will be listed.

You can select a specific schema that you like, migrate (or select all), and you can also specify a custom schema mapping in the target MySQL database.

3. Transfer of objects

At this step, Microsoft SQL Server schema objects, table objects, data types, default values, indexes, primary keys are converted.

Note that the view object, functioning objects, and stored procedures are simply copied and commented on, we will need to convert them manually.

4. Data Migration

At this stage, the automated copy of data is made from the source to the target database for the transferred tables.

Note that with the Migration Wizard, we can only convert tables and copy data, but cannot convert triggers, views, and stored procedures.

We have to do this manually, we could cover this in a future article on how to transfer stored procedures from MS SQL to MySQL.

--

--

Akademily

We conduct reviews, guides and comparative tests of gaming laptops, monitors, graphics cards, keyboards, mouses, headsets and chairs to help you buy the best ga