php sqlstate 08001,php远程连接sql server失败SQLSTATE] => 08001

php远程连接sql server失败SQLSTATE] => 08001

mip版  关注:283  答案:2  悬赏:60

解决时间 2021-02-23 14:25

111e97dc0e3a2b833cd4ea36a970ce20.png

已解决

2021-02-23 02:28

我在本地测试远程连接服务器A的sql server没问题,但是我在服务器B上远程连接服务器A的sql server,出现此错误,跪求解决办法。

Array

(

[0] => Array

(

[0] => 08001

[SQLSTATE] => 08001

[1] => 1231

[code] => 1231

[2] => [Microsoft][SQL Server Native Client 10.0]Named

Pipes Provider: Could not open a connection to SQL Server [1231].

[message] => [Microsoft][SQL Server Native Client

10.0]Named Pipes Provider: Could not open a connection to SQL Server

[1231].

)

[1] => Array

(

[0] => HYT00

[SQLSTATE] => HYT00

[1] => 0

[code] => 0

[2] => [Microsoft][SQL Server Native Client 10.0]Login

timeout expired

[message] => [Microsoft][SQL Server Native Client

10.0]Login timeout expired

)

[2] => Array

(

[0] => 08001

[SQLSTATE] => 08001

[1] => 1231

[code] => 1231

[2] => [Microsoft][SQL Server Native Client 10.0]A

network-related or instance-specific error has occurred while

establishing a connection to SQL Server. Server is not found or not

accessible. Check if instance name is correct and if SQL Server is

configured to allow remote connections. For more information see SQL

Server Books Online.

[message] => [Microsoft][SQL Server Native Client 10.0]A

network-related or instance-specific error has occurred while

establishing a connection to SQL Server. Server is not found or not

accessible. Check if instance name is correct and if SQL Server is

configured to allow remote connections. For more information see SQL

Server Books Online.

)

)

最佳答案

ec20e664aee88b6beeed61e3fbe922e1.png

2021-02-23 03:21

GRANT ALL PRIVILEGES ON 数据库.* TO 'root'@'localhost' IDENTIFIED BY '密码' with grant option;

GRANT ALL PRIVILEGES ON 数据库.* TO 'root'@'%' IDENTIFIED BY '密码'with grant option;

全部回答

80532b55ad56b7c7525ca92d2b266f72.png

1楼

2021-02-23 03:42

应该是你的sql server 2005 没有启用远程连接造成的,请参考以下方法启用远程连接

一、为 sql server 2005 启用远程连接

1. 单击"开始",依次选择"程序"、"microsoft sql server 2005"、"配置工具",然后单击"sql server 外围应用配置器"。

2. 在"sql server 外围应用配置器"页上,单击"服务和连接的外围应用配置器"。

3. 在"服务和连接的外围应用配置器"页上,展开"database engine"(数据库引擎),

单击"远程连接,选择"本地连接和远程连接"复选框,选择适用于您的环境的相应协议(我这里使用tcp/ip),然后单击"应用"。

注意:请在接收到以下消息时单击“确定”。

直到重新启动数据库引擎服务后,对连接设置所做的更改才会生效。

二、启用 sql server browser 服务

1. 单击"开始",依次选择"程序"、"microsoft sql server 2005"、"配置工具",然后单击"sql server 外围应用配置器"。

2. 在"sql server 外围应用配置器"页上,单击“服务和连接的外围应用配置器”。

3. 在"服务和连接的外围应用配置器"页上,单击"sql server browser",在"启动类型"中单击"自动"选项,然后单击"应用"。

4. 单击"启动",然后单击"确定"。

我要举报

如果感觉以上信息为低俗/不良/侵权的信息,可以点下面链接进行举报,我们会做出相应处理,感谢你的支持!

点此我要举报以上信息!

推荐资讯

大家都在看

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值