Cannot connect to LocalDB via sqlcmd Cannot connect to LocalDB via sqlcmd powershell powershell

Cannot connect to LocalDB via sqlcmd


There was a driver bug in ODBC Drive 13. Installing ODBC Driver 13.1 update will fix this.

You can download the driver here.

Afterwards, you should be able to use in cmd or powershell:

sqlcmd -S "(localdb)\MSSQLLocalDB" -i C:\path\to\file.sql


I just got this error and this article solved the problem for me. Start reading from where it says "Visual Studio 2017 & Pathing".

The error message actually occurs because my path variable is pointing to an older version of the sqlcmd tool.... The one that works for all of my SQL Express engines is at:

C:\Program Files\Microsoft SQL Server\110\Tools\Binn\

Using the sqlcmd in that directory worked for me.


try

sqlcmd -S ".\mssqllocaldb"

or

sqlcmd -S ".\mssqllocaldb -uYOUR_User -pYOUR_PASSWORD"