Reputation: 811
I'm new to WSL, and running Ubuntu. I have a local instance of SQL Server 2017 installed in Windows, and want to connect to it from WSL. I have remote connections enabled, however, I can't seem to get connected from ubuntu locally.
I installed the db tools for ubuntu, and I'm using sqlcmd:
sqlcmd -S localhost -U sa -P <my password>
This keeps failing. How do I format/configure this to allow SQL Server in Windows to be available to Ubuntu?
Thanks!
EDIT
I'm using the default instance of SQL Server
Here's the error I'm getting
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..
Pinging localhost:
$ 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
Upvotes: 12
Views: 14340
Reputation: 171
The solution provided by TheTFo for me did not fully work. I had to take it a step further by ensuring that the appropriate IP Address was enabled as well:
On the Protocol tab ensure Yes is selected for Enabled, but also on the IP Addresses tab ensure that Yes is selected for the appropriate IP Address, and check the TCP Port is correctly set (it may be blank):
(Source)
Upvotes: 11
Reputation: 811
Upvotes: 12