Nov. 20, 2015, 12:09 p.m.
IT

How to connect to Microsoft LocalDB

Sometimes you need to connect to an instance of SQL LocalDB and all you have to go on is the ConnectionString that looks like this:

Server=(localdb)\mssqllocaldb;Database=aspnet5...

Trying to use SQL Server Management Studio to connect to (localdb)\mssqllocaldb would most likely fail. Instead, run the command:

sqllocaldb info

Output resembles:

MSSQLLocalDB
v11.0

Pick the corresponding instance and type in:

sqllocaldb info mssqllocaldb

Output resembles:

Name:               mssqllocaldb
Version:            12.0.2000.8
Shared name:
Owner:              PCNAMEuser
Auto-create:        Yes
State:              Running
Last start time:    20-Nov-15 1:05:43 PM
Instance pipe name: np:\\.\pipe\LOCALDB#FE1DF363\tsql\query

Connect using SQL Management Studio to the named pipe np:\\.\pipe\LOCALDB#FE1DF363\tsql\query