从Sqlserver数据库连接到Mysql数据库时出错

从Sqlserver数据库连接到Mysql数据库时出错

问题描述:

hii大家,

我创建一个异构的链接服务器。即我们将从SQL Server环境创建一个到MYSQL数据库服务器的链接服务器,然后从MYSQL查询数据

nw我试图从Sqlserver连接到Mysql,这是我第一次安装的mysql驱动程序在我的系统(其中存在sqldatabase),同时建立与ODBC的连接iam得到这样的错误

连接失败:[HY000] [MYSQL] [ODBC 5.1driver]无法连接到localhost上的mysql服务器(10060)

建立与mysql的连接时它询问以下参数

1)数据源名称=

2 )描述=

3)TCP / IP服务器=

4)用户=

5)密码=

6)数据库=

7)port = 3306(这个端口地址默认出现,我没有给出)

代替DSN我已经给了ODBC,到位了TCP / IP = 10.10.1.173(我的Mysql计算机IP地址)

代替用户我给了''root''

请告诉我iam doi的位置错误并帮我锄头克服这个错误。提前预订



关于

D RAmu

hii everyone,
iam creating a heterogeneous linked server. i.e. We are going to create a linked server to MYSQL database server from SQL Server environment and then going to query datas from MYSQL
nw iam trying to connect from Sqlserver to Mysql,for this first i installed mysql drivers in my system(where sqldatabase is present) while establishing connection to the ODBC iam getting an error like this
"connection failed:[HY000][MYSQL][ODBC 5.1driver]can''t connect to Mysql server on localhost(10060)"
while establishing connection to mysql it is asking the following parameters
1)Data Source Name=
2)Description=
3)TCP/IP server=
4)User=
5)password=
6)Database=
7)port=3306(this port address is coming by default,iam not giving)
In the place of DSN i have given ODBC,in place of TCP/IP=10.10.1.173(my Mysql computer ip address)
in place of user i have given ''root''
Please tell me where iam doing mistake and help me hoe to overcome this mistake.tahnks in advance

With regards
D RAmu

首先,检查你的连接字符串。

尝试在服务器资源管理器窗格中设置VS中的连接:

1)打开服务器资源管理器。

2)右键单击数据连接并选择添加连接

3)在随后的对话框中,选择您的数据源和数据库,指定安全信息,并按测试连接按钮。

4)当连接正常时,按确定

5)在服务器资源管理器窗格中突出显示数据库,然后查看在属性窗格中。将显示连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中。
First, check your connection string.
Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.