Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix MSSQLLocalDB?

On my machine MSSQLLocalDB got corrupted:

    PS C:\WINDOWS\system32> sqllocaldb i
    MSSQLLocalDB
    Projects
    ProjectsV12
    v11.0
    PS C:\WINDOWS\system32> sqllocaldb i mssqllocaldb
    The required LocalDB version "0.0" is not installed.
    PS C:\WINDOWS\system32>

Is there anything I can do short of reinstalling Visual Studio / Sql Server / Sql Express to fix it?

I should mention that any Visual Studio functionality that is dependent on LocalDb is not working because of this, for example CodeMaps

like image 767
Andrew Savinykh Avatar asked Nov 09 '15 05:11

Andrew Savinykh


People also ask

How do I stop MSSQLLocalDB?

Type the SqlLocalDB stop MSSQLLocaDB command in the Command Prompt window: LocalDB instance “MSSQLLocalDB” stopped. Now, repeat the SqlLocalDB delete MSSQLLocalDB command.

What is MSSQLLocalDB?

Microsoft SQL Server Express LocalDB is a feature of SQL Server Express targeted to developers. It is available on SQL Server Express with Advanced Services. LocalDB installation copies a minimal set of files necessary to start the SQL Server Database Engine.

Why SQL Server is not connecting?

The following common scenarios can cause connectivity problems: Incorrect IP address for the Server field. Make sure that the IP address matches the entry in the SQL Server error log file. Incorrect server name in the Server field.


1 Answers

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!

like image 101
Simon_Weaver Avatar answered Sep 19 '22 18:09

Simon_Weaver