---
title: "SQL Server to MySQL migration guide"
description: "Convert a SQL Server script from SSMS into a MySQL script with the same tables, keys and data: how to script, convert, load, and every rule applied."
canonical: https://intosql.com/docs/migrations/sql-server-to-mysql
last_updated: 2026-10-15
---

# SQL Server to MySQL migration guide

IntoSQL reads the script SSMS writes with Generate Scripts and writes one MySQL script with the same tables, columns, keys, indexes, foreign keys, defaults, counters, comments and rows. It reads the script itself, without a database server, and lists in the report every value MySQL can't hold as it is and every object it doesn't carry. The script loads on MySQL 5.7 and later.

**Convert in the browser:** [SQL Server to MySQL](/sql-server-to-mysql) opens the converter set up for this pair.

## Script for the best result

In SQL Server Management Studio, right-click the database, choose **Tasks**, **Generate Scripts**, pick the tables, and under **Advanced** set **Types of data to script** to **Schema and data**. Save it as Unicode (SSMS's default) or UTF-8, as `.sql` or `.sql.gz`. dbatools (`Export-DbaScript`), mssql-scripter and other tools built on SQL Server Management Objects write the same script, from SQL Server 2017 on.

- A script of the data alone still converts: the types are read from the values, and the report says the schema was missing (`no_schema`).
- Tables on a partition scheme arrive as one table with every partition's rows (`partitions_dropped`), and a temporal table and its history table arrive as two plain tables.
- SSMS doesn't script the values of computed and `rowversion` columns; computed columns are written again, and `rowversion` columns are reported (`rowversion_empty`).

## Convert

In the browser, open [SQL Server to MySQL](/sql-server-to-mysql) or the converter on the home page, drop the script and choose MySQL. It reads the file from your disk in pieces, twice, and writes the new script as it goes, so the file is never uploaded and its size isn't limited by memory. The [desktop app](/docs/desktop) does the same with the file on disk.

With the [command line](/docs/cli):

```shell
intosql inspect shop.sql
intosql convert shop.sql --to mysql --output shop.mysql.sql --report shop.report.json
```

`inspect` lists the tables, their rows and what won't be converted, without writing anything. `convert` writes the script and, with `--report`, the report as JSON.

Through the [API](/docs/api), a script converts like any other file: open a conversion with its name ending in `.sql` or `.sql.gz` and `"output": {"dialect": "mysql"}`.

## Load into MySQL

```shell
mysql -e "CREATE DATABASE shop"
mysql --default-character-set=utf8mb4 shop < shop.mysql.sql
```

The script sets the character set and a binary collation, then creates each table with its keys and copies the rows with foreign key and unique checks off. Schemas other than `dbo` become a prefix on their tables' names (`app.orders` is `app_orders`). The `IDENTITY` column that leads each primary key becomes `AUTO_INCREMENT` and continues after the highest id. `datetimeoffset` values are stored as `datetime` in UTC (`moments_as_utc`), and `datetime2` keeps six digits of a second (`fraction_cut`). Columns with a collation that ignores case compare exactly, so unique keys keep apart what SQL Server kept apart, and the report says how many there are (`case_insensitive_collation`). MySQL has no sequences (`sequence_not_converted`).

### Or load it straight in

`intosql load` and the [desktop app](/docs/desktop) load the dump into MySQL without a script, with the same tables, keys and indexes the script creates:

```shell
intosql load shop.sql --into mysql://ana@localhost/shop
```

It stops before writing anything when one of the dump's tables already exists. MySQL can't roll back a table, so a failed load drops the tables it created. Loading into a database server is part of IntoSQL Pro, with a 14-day trial. See [Loading](/docs/loading#database-dumps).

## What isn't converted

Views, functions, procedures, triggers, synonyms, rules and security policies are written in T-SQL. They are listed in the report by kind and name, never dropped silently, so you can recreate them in MySQL.


## Data types

[SQL Server to MySQL data types](/docs/types/sql-server-to-mysql) lists each type that changes in the script: what it becomes, why, and the report line.

## Every other rule

Generated from the engine, where each rule is decided.

| In SQL Server | In MySQL | Why | Report line |
| --- | --- | --- | --- |
| collations that ignore case (_CI_) | exact comparison (utf8mb4_bin) | Tables use utf8mb4_bin so unique keys keep apart what SQL Server kept apart; columns that ignored case lose that. Accent rules differ between versions, so no _ci collation matches SQL Server's on every one. | `case_insensitive_collation` |
| CREATE SEQUENCE | not created | MySQL has no sequences. The values a sequence handed out are in the rows. | `sequence_not_converted` |
| computed columns | generated columns, STORED when PERSISTED, VIRTUAL otherwise | MySQL computes them the same two ways, with CONCAT written so NULL counts as empty as in SQL Server. | None |
| computed columns with functions MySQL lacks | a plain column | A formula that can't be written leaves a plain column and a report line; SSMS scripts no values for computed columns. | `generated_not_translated` |
| defaults with functions MySQL lacks, and NEXT VALUE FOR | no default | A default that can't be written is left out and reported. | `default_not_translated` |
| CHECK constraints | translated | MySQL 5.7 keeps them without checking; the others test them as each row loads. | None |
| CHECK constraints with functions MySQL lacks | not created | A check that can't be written is left out and reported. | `check_skipped` |
| CHECK constraints added WITH NOCHECK or disabled | not created | SQL Server doesn't apply these checks, so the rows may break them. | `check_not_enforced` |
| filtered and columnstore indexes | not created | IntoSQL writes b-tree indexes on whole columns; create the others again after loading. | `index_skipped` |
| foreign keys | foreign keys, loaded with FOREIGN_KEY_CHECKS=0 | The rows load in any order, and the keys check new rows afterwards. | None |
| foreign keys to tables the dump doesn't create | not created | A key can't name a table that isn't there. | `foreign_key_skipped` |
| tables on a partition scheme | one table with every partition's rows | The rows are the same; partition the table again in MySQL if it needs it. | `partitions_dropped` |
| temporal tables (SYSTEM_VERSIONING) | two tables: the current rows and the history | The table and its history table are copied as plain tables; MySQL doesn't keep the history by itself. | `system_versioning_dropped` |
| schemas | one database, tables named after their schema first | MySQL's schemas are databases, which a script loaded into one database can't create; tables in dbo keep their names. | `schemas_merged` |
| NOT NULL columns with values that become NULL | NOT NULL dropped | A column whose values had to become NULL can't keep NOT NULL, or the load would stop. | `not_null_relaxed` |
| views, functions, procedures, triggers, synonyms, types and partition functions | listed in the report | Their code is written in T-SQL, so they are listed for you to recreate. | `not_converted_objects` |
| scripts without CREATE TABLE (data only) | types read from the values | A data-only script has only rows, so the types come from the values. | `no_schema` |
| expressions in INSERT values | NULL | A converter that doesn't run a database can't evaluate them. | `expression_value` |
| text decoded twice (Ã±) | copied as it is | The script holds exactly these characters, so they are copied; the report points them out. | `mojibake_suspected` |
