Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6186

How to connect to a local Windows SQL Server Instance from WSL? [closed]

$
0
0

I'm using WSL, running Ubuntu. I have a local instance of SQL Server 2022 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 WSL Ubuntu locally.The local instance in Windows uses Windows Authentication. In Windows cmd, I use sqlcmd and it worked normally:sqlcmd -S .\<InstanceName>

I installed mssql-server, mssql-tools, unixodbc-dev for WSL ubuntu, and I'm using sqlcmd in WSL cmd:sqlcmd -S localhost\<InstanceName> -U SA -P <Passoword>But it returned:

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 0x2AF9.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..

I've googled that error and tried (or have already done) many of the suggested solutions, including:

  • Ensured my inbound ports are setup for windows firewall; 1433 for Sql Server and 1434 for Sql Server Browser (I even turned off the Firewall).
  • Ensured that Sql Server and Sql Server Browser are running.
  • Ensured that TCP/IP is Enabled in SQL Server Network Configuration > Protocols for my local instance in Windows.
  • Ensured that the IP Address for WSL is Active, Enabled, and has TCP port 1433 TCP/IP properties.
  • Ensured that TCP Port is set to 1433 for TCP/IP properties > IPAll.
  • I've checked that the instance name.
  • Ensured that my database ALLOWS remote connections.
  • Ensured that the database allows mixed Sql Server and Windows Authentication.
  • I've tried several variations of the Server: IP, InstanceName, IP\InstanceName, localhost\InstanceName, MachineName\InstanceName.

How do I format/configure this to allow SQL Server in Windows to be available to Ubuntu?


Viewing all articles
Browse latest Browse all 6186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>