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
I figured out my problem. TCP/IP was not enabled in the server protocols.
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. Refer to Step 6 of this resource for instructions on how to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With