The specified LocalDb instance does not exist

Roman Mik picture Roman Mik · Sep 24, 2014 · Viewed 25.4k times · Source

I've been using a localDB named 'Projects' for a while now. This is the same database that is created by default ASP.NET MVC 5 project. However, suddenly it stopped and I'm not able to connect to it nor restart it using

SqlLocalDb start Projects

I get

The specified LocalDB instance does not exist.

I see the folder in

C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects

also, I have v11.0 in

C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0

I'm able to connect to v11.

What else can I try to reconnect to it?

The connection string is

 <add name="DefaultConnection"  connectionString="Data Source=(localdb)\Projects;Initial Catalog=master;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False" providerName="System.Data.SqlClient" />

Edit

I tried Attaching the Db file to the connection string

AttachDbFileName=C:\Users\[My UserName]\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\Projects\master.mdf;

However, I'm still not able to connect

A network-related or instance-specific error occurred while establishing a connection to SQL
Server. The server was not found or was not accessible. Verify that the instance name is correct
and that SQL Server is configured to allow remote connections. (provider: SQL Network
Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance
does not exist.)

Answer

Mrchief picture Mrchief · Sep 24, 2014

Seems like (localdb)\Projects instance got deleted. You can either use (localdb)\v11.0 or recreate Projects instance using SqlLocalDB utility

sqllocaldb c Projects 11.0

Command line explained

  • c - is for "create"
  • "Projects - is the instance name
  • 11.0 is the version