mysql database data can be imported into the sql server

of course.

A. Install the ODBC driver for MySQL 

  1. Download MySQL ODBC Connector, download: http: //dev.mysql.com/downloads/connector

  2. From the Control Panel - Administrative Tools, open your data source (ODBC), the election system, DNS, points are added.    

  3. In the Create New Data Source dialog box, select the MySQL ODBC 5.1 Driver, the completion point.  

  4. MySQL Link dialog box will appear after completion, add your MySQL database account information and confirm whether the "root" account has all the permissions, if you install MySQL have not changed, then do not change the port number 3306.

  5. Point "Test" button to confirm your links are correct. Press the "Test" button to ensure your connection settings are set properly and then the "OK" button when you're done.

    II. Create a Microsoft SQL to MySQL link

    1. Open SQL Server Management Studio in a new query statement to copy it, modify your database name, and run. 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 through an ODBC driver to create a connection to your MySQL database, the connection appears in the Microsoft SQL Server Management Studio in the following figure: this figure does not appear, then refresh.

    Three I. data between the two databases

    Created in Microsoft SQL Server in a new database (such as: testMySQl), copy the following statement in the new query, the MySQL database to be run after the "tigerdb" imported into Microsoft SQL database "testMySQl" in.    

    SELECT * INTO testMySQL.dbo.shoutbox FROM openquery(MYSQL, 'SELECT * FROM tigerdb.shoutbox')

Guess you like

Origin www.cnblogs.com/sqlservertongbu/p/11013449.html