Migrating from MariaDB to SQL Server moves tables, data, and routines while converting MySQL-specific syntax into T-SQL equivalents.
Gain tighter integration with Microsoft tooling, larger ecosystem support, and enhanced analytics features such as columnstore indexes and Always On availability groups.
Install SQL Server Migration Assistant (SSMA) for MySQL, create an empty SQL Server database, configure an ODBC driver for MariaDB, and back up the source.
Run mysqldump --no-data --routines --events --compatible=mssql ecommerce > schema.sql
.The --compatible=mssql
flag helps trim MySQL-only options.
Open SSMA, connect to MariaDB and SQL Server, choose objects, click “Convert Schema,” inspect warnings, then “Synchronize with Database.” SSMA creates T-SQL equivalents automatically.
Replace UNSIGNED
with larger signed types, change DATETIME
default '0000-00-00'
to NULL, and convert AUTO_INCREMENT
to IDENTITY(1,1)
.
Select “Migrate Data” in SSMA or use a linked server: EXEC sp_addlinkedserver ...
, then INSERT INTO dbo.Customers SELECT * FROM MARIA_DB...Customers
.Wrap each table in a transaction.
Export CSV with SELECT ...INTO OUTFILE
, then run BULK INSERT dbo.OrderItems FROM 'C:\exports\OrderItems.csv' WITH (FIELDTERMINATOR=',', ROWTERMINATOR='\n');
Run row counts, checksum comparisons, and spot-check orders: SELECT COUNT(*) FROM dbo.Orders EXCEPT SELECT COUNT(*) FROM MARIA_DB...Orders;
Enable binlog replication to SQL Server using mysqlbinlog
+ SSMA CDC, pause writes, run a final incremental load, swap application connection strings, and monitor errors.
Clean up orphaned FK constraints first, migrate lowest-traffic hours, script repeatable tasks, and keep both systems in read-only mode during switchover.
Unsigned integers overflow. Convert to BIGINT
or add data-range checks.
Zero dates rejected. Replace with NULL
or valid defaults before import.
.
Yes, SSMA converts most MariaDB procedures and functions to T-SQL. Review any warnings for syntax that requires manual rewriting.
SSMA maps AUTO_INCREMENT
columns to IDENTITY(1,1)
. Existing values remain unchanged, and next-value seeds continue correctly after import.
Ensure both servers use UTF-8/UTF-16. In SSMA, enable “Convert to NVARCHAR” to preserve multibyte characters and avoid mojibake.