sql-server – 尝试运行sqlcmd失败,无法建立连接?

前端之家收集整理的这篇文章主要介绍了sql-server – 尝试运行sqlcmd失败,无法建立连接?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试运行sqlcmd(从cmd提示符)时,我收到以下错误

HResult 0x2,Level 16,State 1
Named Pipes Provider: Could not open a connection to sql Server [2].
sqlcmd: Error: Microsoft sql Server Native Client 10.0 : A network-related or in
stance-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 i
f sql Server is configured to allow remote connections. For more information see
sql Server Books Online..
sqlcmd: Error: Microsoft sql Server Native Client 10.0 : Login timeout expired.

不知道为什么会这样?我可以从我的asp.net网站(在本地运行,如数据库)连接到sql server,但sqlcmd无法连接.

解决方法

尝试sqlcmd -S< InstanceName>

>只有将服务器安装为默认实例时,您的命令才有效.>运行sp_helpserver以了解实例名称.

猜你在找的MsSQL相关文章