【发布时间】:2019-07-16 00:48:30
【问题描述】:
我是 WSL 新手,正在运行 Ubuntu。我在 Windows 中安装了 SQL Server 2017 的本地实例,并希望从 WSL 连接到它。我启用了远程连接,但是,我似乎无法从本地 ubuntu 连接。
我为 ubuntu 安装了 db 工具,我正在使用 sqlcmd:
sqlcmd -S localhost -U sa -P <my password>
这一直失败。如何格式化/配置它以允许 Windows 中的 SQL Server 可用于 Ubuntu?
谢谢!
编辑
我正在使用 SQL Server 的默认实例
这是我遇到的错误
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 17 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..
ping 本地主机:
$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=128 time=0.248 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=128 time=0.497 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=128 time=0.517 ms
【问题讨论】:
-
“一直失败”是什么意思?您收到什么错误消息?
-
你能从 Ubuntu ping localhost 吗?您的服务器是默认实例还是命名实例?
-
感谢您的回复,抱歉我漏掉了这些信息。我用错误编辑了我的帖子,以及 ping 结果。我正在使用默认实例
标签: sql-server ubuntu windows-subsystem-for-linux