Info2soft use cookies to help you have a superior and more admissible browsing experience on our website. Privacy Policy
Loading...
Microsoft SQL Server and MySQL are both commonly used databases by enterprises to manage data and support businesses. But sometimes, SQL Server users will want to convert databases from SQL Server to MySQL due to some reasons, such as:
No matter for what purpose, you can keep on reading, we will give you 4 methods to convert SQL Server database to MySQL.
MySQL workbench is a graphical tool for managing MySQL database. It has a built-in migration wizard that can convert SQL server databases to MySQL and help you handle schema and data transfer.
Step 1. Open MySQL Workbench. Go to Database > Migration Wizard.
Step 2. Then you will be guided through a series of screens. Choose Microsoft SQL Server as the source RDBMS.
Step 3. Click “New…” to create a source connection.
Step 4. Enter “Hostname”, “Port”, “Username”, “Password”. And test the connection, you may need to select the correct ODBC driver.
Step 5. Now, choose MySQL as the target RDBMs.
Step 6. Create a new target connection or select an existing one.
Step 7. Enter “Hostname”, “ Port”, “Username”, “Password”. And “test connection“.
Step 8. Then the wizard shows available SQL Server databases. Select one or more schemas to migrate according to your needs. Then click “Next”.
Step 9. MySQL Workbench will analyze the SQL Server schema by reading tables, views, procedures, and other objects. Then it will automatically convert SQL Server schema to MySQL syntax.
Step 10. Review the generated script, and you can edit mappings manually before proceeding. Click “Next”.
Step 11. Now you can let Workbench create Schema automatically or export script and review it manually first.
Then the wizard can copy the data directly from SQL Server to MySQL. Depending on the size, this can take a while.
After migration, open MySQL Workbench and browse the new schema. And check data integrity and test key queries or applications.
MySQLyog is another way to switch to MySQL from SQL Server, but it doesn’t natively perform schema conversion, you will need to export and import schema. Here are the detailed steps.
Step 1. Firstly, you will need to export the schema (structure only) from SQL Server. In SQL Server Management Studio (SSMS), right-click “Database” > “Tasks” > “Generate Scripts” > “Schema only”.
Step 2. Open the .sql file and manually edit it to fit MySQL syntax:
Remove or change:
Then Save as mysql_schema.sql
Step 3. In SQLyog, connect to your MySQL server and execute this .sql file: “File” > “Open SQL Script” > “Execute”
Step 4. Open ODBC Data Source Administration. Go to “System DSN” or “User DSN” > click “Add”. Choose “ODBC driver for SQL Server”.
Step 5. Choose database you want to migrate. Enter “Data Source Name”, “Server Name”, “Authentication”. And “Save”.
Step 6. Open SQLyog, go to “Tools” > “Import External Data” > “Import from ODBC Data Source”. Choose ODBC source, select SQL Server database and target MySQL database.
Step 7. Choose whether to create a table automatically or to import only data into an existing table. Then start the import.
Wait for the migration to get finished.
Step 1. Also, you will need to go SQL Server Management Studio to export SQL Server schema: Generate Scripts > Select Database > Choose “Schema and Data“. Save as .sql file
Step 2. Then convert SQL syntax. Replace data types, such as:
Replace identifiers:
Step 3. You can import the converted .sql script into MySQL:
mysql -u root -p your_database < converted_schema.sql
Step 4. Use bcp or SQL Server Import/Export Wizard to export CSVs, then:
For larger databases or production environments where downtime must be minimized, a dedicated database replication solution can make SQL Server to MySQL migration more manageable.
i2Stream is a database replication solution that supports heterogeneous database synchronization, including Microsoft SQL Server and MySQL. i2Stream can continuously synchronize changes between supported source and target databases, helping organizations keep their target MySQL database up to date while the source SQL Server remains in operation.
Key benefits of using i2Stream for SQL Server to MySQL migration include:
When should you use i2Stream? It is particularly suitable for enterprise SQL Server to MySQL migrations where the source system needs to remain available during data transfer, ongoing changes must be synchronized, and data consistency is critical.
You can click the download button to get a free trial:
In this post, we discussion how to convert SQL Server to MySQL databases using MySQL Workbench, MySQLyog, command and a professional database migration tool. You can choose a suitable method according to your needs.
By contrast, the professional data migration solution – i2Stream is much more suitable. It streamlines the process and much more suitable for most large database environments.
Q: Can I migrate SQL Server databases to MySQL without downtime?
A: Yes. Professional migration tools such as i2Stream allow real-time replication, enabling minimal or zero downtime migrations.
Q: How long does a SQL Server to MySQL migration take?
A: Migration time depends on the database size, schema complexity, and chosen tool. Small databases may take minutes, while enterprise-scale migrations can take several hours or days.
Q: Can I convert SQL Server bak. file to MySQL Online?
A: No, you cannot directly convert a .bak (SQL Server backup) file to MySQL online, because .bak files are proprietary SQL Server backup formats, not standard SQL scripts or data dumps.
· Enterprise & Mid-market Customers Worldwide
· Support team available to assist you throughout your trial
· Start a 60-day free trial or view demo to see how Info2Soft protects enterprise data.