----创建ODBC链接
EXEC sp_addlinkedserver @server = 'MySQL', @srvproduct='MySql' , @provider = 'MSDASQL', @provstr = 'Driver={MySQL ODBC 5.1 Driver}; Server=localhost; Database=test; User=root; Password=; Option=3;' ----增加访问权限
EXEC sp_addlinkedsrvlogin @rmtsrvname='MySql' , @useself='false' , @locallogin='sa' , @rmtuser='root' , @rmtpassword=''
SELECT * FROM OPENQUERY (mysql ,'select * from UserTable')//测试访问数据库