Wednesday, June 23, 2010

How to create a Linked Server to MySQL from SQL Server 2008

Download Connector/ODBC for mySQL from

http://dev.mysql.com/downloads/connector/odbc/5.1.html


Install the Connector/ODBC driver on the Server where SQL Server 2008 installed.
Create an ODBC System DSN using the installed MySQL Driver



Select System DSN , Add



Select the MySQL Driver then Click 'Finish'



Fill out the appropriate information and click 'Test'






Create a Linked Server at SQL Server 2008 Management Studio.

Under 'Server Objects', right click on 'Linked Servers' and select 'new Linked Server'



At 'Link Server' type a Name
On 'Other data sources' , Select 'Microsoft OLE DB Provider for ODBC Drivers'
Type the DSN name you just created at 'Data Source'



at security , specify the appropriate login information



on 'Server options' select 'True' for both 'RPC' and 'RPC Out'




Modify the properties of the MSDASQL provider:




Use OPENQUERY to Query the Linked Server.

SELECT TOP 10 * FROM OPENQUERY(MKMYSQL, 'SELECT * FROM Users')

Last Modified : June 23, 2010

No comments:

Post a Comment