How to Migrate Microsoft SQL Server to MySQL Database

If you are using mostly open source in your enterprise, and have few MS SQL server database around, you might want to consider migrating those to MySQL database.

The following are few reasons why you might want to consider migrating Microsoft SQL Server to MySQL database:
  • To avoid huge License and support fees of MS SQL Server. In MySQL, even if you decide to use the MySQL enterprise edition, it is less expensive.
  • Unlike SQL Server, MySQL supports wide range of Operating Systems including several Linux distros, Solaris and Mac.
  • To implement a highly scalable database infrastructure
  • To take advantage of several advanced features of MySQL database that have been tested intensively over the years by a huge open source community
We can migrate MS SQL database to MySQL using migration module of “MySQL Workbench” utility.

The most easiest way to install MySQL Workbench is to install “Oracle MySQL installer for windows”, which installs several MySQL tools including the Workbench.

Download and install this MySQL Installer, which includes Workbench and other necessary connectors and drivers required for the migration.

The following is an overview of the steps involved in the migration of MsSql database to MySQL using Workbench migration wizard.

1. Take care of Prerequisites

Before starting the MySQL database migration wizard in Workbench, we need to ensure that ODBC drivers are present for connecting to the source Microsoft SQL Server database, as it is not bundled with Workbench.

Verify that the max_allowed_packet option in the MySQL server is sufficient for the largest field to be migrated.

Ensure that we can connect to both destination MySQL server database, and source MsSQL Server database with appropriate privileges that are required for migrating the data across.

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

2. Select Source and Target Database

First, define the source Microsoft SQL Server database connection parameter. Select “Microsoft SQL Server” from the database system dropdown list. In the parameters tab, select the DSN, and specify the username to the source database.

Next, define the destination MySQL database connection paramter. Select “Local Instance MySQL” or “Remote Instance MySQL” depending on your situation. In the parameters tab, specify the hostname or the ip-address where the MySQL database is running, the MySQL port, username. If you don’t specify the password, it will prompt you.

Once you specify the source and destination, all available schemas and databases will be listed. You can select the specific schema that you like to migration (or select all), and you can also specify custom schema mapping to the destination MySQL database.

3. Migrate the Objects

In this step the Microsoft SQL Server schema objects, table objects, data types, default values, indexes, primary keys are converted. Please note that view object, function objects and stored procedures are just copied and is commented out as we will need to convert those manually.

4. Data Migration

In this step the automated copy of data is done from source to destination database for the migrated tables.

Please note that using the migration wizard we can only convert tables and copy data but cannot convert the triggers, views and stored procedures. We’ll have to do those manually, which we might cover in one of the future article on how to migrate MS SQL stored procedures to MySQL stored procedures.
RaphBlog.Com.NG. Powered by Blogger.