This article discusses how to import a MySQL database into SQL Server, so first you need to install both databases, and then follow the steps below.
I. Installing ODBC Drivers for MySQL
1. Download MySQL ODBC Connector, Download:/http/dev.mysql.com/downloads/connector
2. From the Control Panel-Admin tool, open your data source (ODBC), select System DNS, point Add.
3. In the Create New Data Source dialog box, select MySQL ODBC 5.1 Driver, click Finish.
4. After the completion of the MySQL Link dialog box, add your MySQL database account information, and confirm that the "root" account has all the permissions, if you install MySQL is not modified, do not change the port number 3306.
5. Click the "Test" button to confirm that your link is correct.
Press the "Test" button to ensure your connection settings is set properly and then the "OK" button when you ' re done.
Two. Create a Microsoft SQL to MySQL link
1. In SQL Server Management Studio, open a new query, copy the statement, modify the name of your database, and run it.
EXEC Master.dbo.sp_addlinkedserver
@server = N ' MYSQL ',
@srvproduct =n ' MySQL ',
@provider =n ' Msdasql ',
@provstr =n ' driver={mysql ODBC 5.1 DRIVER}; Server=localhost; _
Database=tigerdb; User=root; Password=hejsan; Option=3 '
2. This script creates a join to your MySQL database via the ODBC driver, which appears in Microsoft SQL Server Management Studio such as:
If this diagram does not appear, it will be refreshed.
Three. Guide data between two databases
Create a new database in Microsoft SQL Server (for example:testmysql), copy the following statement in new query, and then run the MySQL database " tigerdb” 导入到 Microsoft SQL 数据库“testMySQl”中。
SELECT * into TestMySQL.dbo.shoutbox
From OPENQUERY (MYSQL, ' SELECT * from Tigerdb.shoutbox ')
These are all the steps.
This digest from: http://blog.csdn.net/caijing3210/article/details/7238953
Thanks to the author for guidance.
How to import data from MySQL to SQL Server