将数据库导入 MySQL 数据库

Import database into MySQL database

我有一个从 MS-SQL 服务器 2005 生成的 (.mdf) 文件,现在我想将该数据库转换为 MySQL。但是,不完全是,只有特定的表及其数据。

.mdf 文件不适合您的用途。最好使用 SQL 服务器的批量复制程序 BCP 导出 table 数据,然后使用 MySQL 的 LOAD DATA INFILE 导入。

来自Mysql migration guide

For those using SQL Server who are not familiar with Integration Services, it is possible to move data from SQL Server to MySQL using a combination of the SQL Server bulk copy program (BCP) and the MySQL LOAD DATA INFILE utility. A DBA can create data files with SQL Server BCP where the data is delimited by an appropriate character (such as a comma, semi-colon, etc.) and then load the data into MySQL with LOAD DATA INFILE with the same delimiter being specified.

MySQL Workbench 有一个完全适合该场景的迁移模块。您不需要创建 mdf 文件,但可以直接将整个数据库或单个 table 从 MS SQL 迁移到 MySQL。或者,您可以将数据导出到 CSV 文件并使用 table 导入器导入(您至少需要 MySQL Workbench 6.3,它可以作为 RC atm 获得,并且很快可以作为GA).

通过 MYSQL 迁移解决了我的问题 首先制作 ODBC MS-SQL 驱动程序,然后使用完整数据

从 MS-SQL 服务器导入数据库