加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – 无法通过sqlcmd连接到LocalDB

发布时间:2020-12-12 08:33:11 所属栏目:MsSql教程 来源:网络整理
导读:我正在学习SQL Server,并且使用sqlcmd连接到本地数据库时遇到问题. 当我在Powershell中输入以下内容时: sqlcmd -S "(localdb)mssqllocaldb" 我收到以下错误信息: Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : SQL Server Network Interfaces
我正在学习SQL Server,并且使用sqlcmd连接到本地数据库时遇到问题.

当我在Powershell中输入以下内容时:

sqlcmd -S "(localdb)mssqllocaldb"

我收到以下错误信息:

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : SQL Server Network Interfaces: The system cannot find the file specified.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : 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.

如果我使用SQL Server Management Studio,我可以连接到本地数据库.如果我使用实例名称管道,我也可以连接到本地数据库.

我有一个干净的安装的Windows 10 x64,Visual Studio社区和SQL Server Management Studio 2016.

谢谢!

解决方法

尝试
sqlcmd -S ".mssqllocaldb"

要么

sqlcmd -S ".mssqllocaldb -uYOUR_User -pYOUR_PASSWORD"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读