Now Available: SQL Server Migration Assistant for MySQL!

The SQL Server Migration Assistant (SSMA) team announced today the availability of the migration assistant for MySQL! (Yes, it supports SQL Server Express.) You can…

Actually, the team announced the release of three other migration assistants: SSMA for Access, SSMA for Oracle, and SSMA for Sybase (all v4.2). But, I’m most excited about the MySQL assistant, not only because it is a v1.0 release, but because I think it will come in handy for lots of people…I’ve seen the “How can I easily migrate a MySQL database to SQL Server?” question come up occasionally on forums that I watch. The bonus that this release adds is that it can also migrate a MySQL database directly to the SQL Azure cloud.

I had a chance to play with the SQL Server Migration Assistant for MySQL when it was in beta a few months ago. It did a great job then of migrating a simple MySQL database, but the team has added lots of functionality since the first beta release (including support for migrating stored procedures). The download includes a help file with documentation that will give you an understanding of other features the team has added. What I’ll do here is walk you through the “Hello World”-type usage of the assistant. I’ll use SSMA to move a MySQL WordPress database to SQL Server.

Note: I’m just showing how to migrate a WordPress database as an example. If you actually want to run WordPress on SQL Server, see this post by Zach Owens: WordPress on Microsoft.

1. Download the SQL Server Migration Assistant. After the installation, start the application by double-clicking the shortcut on your desktop:


Be sure to make note of the prerequisites that are listed in the Installing SSMA for MySQL Client help topic. If you don’t, the assistant will prompt you to download the prerequsites (I needed the MySQL ODBC Connector). 

2. Obtain a registration key. The first time you use SSMA for MySQL, you will be directed to a site from which you can obtain a registration key (stored in a file called mysql-ssma.license). You will have to indicate the directory in which you will save this file:



3. Create a new project. Once the program is running, click on the New Project icon in the upper left corner to get started:


At this point, you have to decide if you want to migrate to SQL Server or SQL Azure in the dialog box that opens (I’m choosing SQL Server for this example):


4. Connect to MySQL. Click on the Connect to MySQL icon in the upper left corner (you’ll have to supply connection credentials). This will allow you to see a tree view of your MySQL metadata and several tabs that contain information about schema mapping (we’ll leave the default values for the schema mapping here).



5. Create a schema migration report. Select a database to migrate, then right-click the database name and select Create Report:


The generated report will allow you to see any issues that might arise in schema migration. If there are any issues, you may want to address them by changing some of the default schema mapping settings (edit values in the tabs I mentioned in step 4).


6. Connect to SQL Server (or SQL Azure, depending on what you chose in step 3). Click on the Connect to SQL Server icon in the upper left corner. You can supply credentials to connect to SQL Server or SQL Azure. If a database with the same name as the MySQL database you chose in step 4 doesn’t exist, you’ll be asked if you want to create one.

Note: If you don’t want SSMA to create the database for you, you should specify the database you want to migrate to in the connection dialog. By default, SSMA for MySQL converts all the objects from database DB1 into SQL Server schema DB1.dbo and SQL Server database DB1 must be created before synchronization (see step 8). The easiest way to do so is to specify the name of the database in SQL Server connection dialog when establishing connection to SQL Server.


You should now see a tree view of SQL Server metadata in the SQL Server Metadata Explorer. Select the schema to which you want to migrate.


7. Convert the schema (i.e. tables). In the MySQL Metadata Explorer, right-click the database you are migrating and select Convert Schema:


At this point, you may want to make some changes to the converted schema. For example, I chose to make the link_updated column a nullable column, because the MySQL default value for this column, 0000-00-00 00:00:00, is a special value that will be treated as a null value when data is migrated. Not making this change here could cause problems when I migrate data.



8. Synchronize the SQL Server database. To create converted tables in SQL Server, right-click the database you want to migrate to in the SQL Server metadata explorer and select Synchronize with Database.


Click OK when the Synchronize with Database dialog box opens.


9. Migrate the data. In the MySQL Metadata Explorer, right-click on the database you are migrating and select Migrate Data. You will have to again supply connection credentials for both the MySQL and SQL Server databases before the data is migrated.



And now your database schema and data should be migrated.

Let me and the SSMA team know what you think of this tool. You can provide feedback in comments here or on the SSMA team blog:



Share this on Twitter

No Comments