在使用SQL Server Express的时候经常会碰到如下告警:
TITLE: Connect to Server
------------------------------
Cannot connect to ..
------------------------------
ADDITIONAL INFORMATION:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
在这种情况下,可以按以下步骤尝试:
1. [可选] SQL Server Management Studio Express
为了使用方便,可以先到 http://go.microsoft.com/fwlink/?LinkId=65110 去下载一个类似SQL2000的 企业管理器的工具( SQL Server Management Studio Express)。
2. 允许TCP/IP
在 SQL Server Configuration Manager中将 Protocols for SQLExpress-> TCP/IP设为 Enabled。
3. [可选] IP Dynamic Ports
在 SQL Server Configuration Manager中 SQL Server Browser服务设为 Enabled。同时,为了减少SQLExpress被攻击表面,可将 Protocols for SQLExpress-> TCP/IP Properties 中的 IP Dynamic Ports清空,并设置 TCP Port为 1433(推荐,如果没有SQLServer9.0以下版本;或其它)。
3. [可选] 防火墙
如果在完成 1-2-3 步骤后仍不能解决问题,可以检查一下防火墙设置,这里就不再多说了。
TITLE: Connect to Server
------------------------------
Cannot connect to ..
------------------------------
ADDITIONAL INFORMATION:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
在这种情况下,可以按以下步骤尝试:
1. [可选] SQL Server Management Studio Express
为了使用方便,可以先到 http://go.microsoft.com/fwlink/?LinkId=65110 去下载一个类似SQL2000的 企业管理器的工具( SQL Server Management Studio Express)。
2. 允许TCP/IP
在 SQL Server Configuration Manager中将 Protocols for SQLExpress-> TCP/IP设为 Enabled。
3. [可选] IP Dynamic Ports
在 SQL Server Configuration Manager中 SQL Server Browser服务设为 Enabled。同时,为了减少SQLExpress被攻击表面,可将 Protocols for SQLExpress-> TCP/IP Properties 中的 IP Dynamic Ports清空,并设置 TCP Port为 1433(推荐,如果没有SQLServer9.0以下版本;或其它)。
3. [可选] 防火墙
如果在完成 1-2-3 步骤后仍不能解决问题,可以检查一下防火墙设置,这里就不再多说了。