How to fix MSSQLLocalDB?

This can occur if you've just installed LocalDB and haven't started the instance yet. I'm not sure if rebooting would have restarted it for me (I imagine it would have), but the following worked without needing to:

C:\Users\sweaver>sqllocaldb.exe s MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" started.

That should be all you need - but here is the full diagostics steps I used in the process.


This is before installing new version of LocalDB (2014)

C:\Users\sweaver>sqllocaldb.exe i
v11.0

Afterwards

C:\Users\sweaver>sqllocaldb.exe i
MSSQLLocalDB
v11.0

Then I immediately get this error

C:\Users\sweaver>sqllocaldb.exe i MSSQLLocalDB
The required LocalDB version "0.0" is not installed.

Strange! What about version 11 - that's ok

C:\Users\sweaver>sqllocaldb.exe i v11.0
Name:               v11.0
Version:            11.0.5343.0
Shared name:
Owner:              RR2014\sweaver
Auto-create:        Yes
State:              Running
Last start time:    3/10/2016 3:00:29 PM
Instance pipe name: np:\\.\pipe\LOCALDB#60C1AC49\tsql\query

Here's the versions

C:\Users\sweaver>sqllocaldb.exe v
Microsoft SQL Server 2012 (11.0.5343.0)
Microsoft SQL Server 2014 (12.0.2000.8)

Let's try starting it

C:\Users\sweaver>sqllocaldb.exe s MSSQLLocalDB
LocalDB instance "MSSQLLocalDB" started.

And try again...

C:\Users\sweaver>sqllocaldb.exe i MSSQLLocalDB
Name:               MSSQLLocalDB
Version:            12.0.2000.8
Shared name:
Owner:              RR2014\sweaver
Auto-create:        Yes
State:              Running
Last start time:    3/10/2016 3:10:55 PM
Instance pipe name: np:\\.\pipe\LOCALDB#1D3F49F3\tsql\query

Phew! That was easy!


What I ended up doing follows. Note, that I'm sure this is not a correct way of doing this, but rather a messy hack. It allowed me getting my CodeMaps working again though, so I'm happy.

I deleted the mssqllocaldb

sqllocaldb d mssqllocaldb

The system won't let me create it again so I created another one:

sqllocaldb с mssqllocaldb1

I went to "C:\Users\[username]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\" and backed up MSSQLLocalDB folder. Then I copied MSSQLLocalDB1 folder to MSSQLLocalDB.

In registry I found the new instance under HKCU\Software\Microsoft\Microsoft SQL Server\UserInstances\ and changed the DataDirectory value to reflect the new path, that is to end with MSSQLLocalDB instead of MSSQLLocalDB1.

After that I was able to start MSSQLLocalDB successfully and CodeMaps worked:

PS C:\WINDOWS\system32> sqllocaldb s mssqllocaldb

LocalDB instance "MSSQLLocalDB" started.