Wednesday, March 11, 2009

Create a MS SQL link to MySQL database

To create a MS SQL link to MySQL database, first be sure to install the MySQL ODBC Connector from here: http://dev.mysql.com/downloads/connector/

Create a new System DNS for the MySQL Database on the ODBC Data Source Administrator from the Control Panel | Administrative Tools

To establish a link to the MySQL database from the Microsoft SQL Server Management Studio, open a query window and run the following SQL statement:

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=; USER=root; PASSWORD=; OPTION=3'


This script will produce a link to the MySQL database through the ODBC connection.




0 comments: