Cannot start SqlLocalDB instance with my Windows account

Check the error log which usually under the folder %localappdata%\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0 will give you big hints.

Log back in as the administrator account (not an administrator), and start a command prompt with Run As Administrator. Then run this:

sqllocaldb share v11.0 MyInstance

You might want to explicitly add your Windows account as a sysadmin on this instance if that is a goal. So:

sqllocaldb start MyInstance

Then connect with SQLCMD, Management Studio, what have you, and run:

CREATE LOGIN [Domain\Username] FROM WINDOWS;
EXEC sp_addsrvrolemember N'Domain\Username', N'sysadmin';

Now log back in as your Windows account, and you should be able to start this instance using:

sqllocaldb start MyInstance

(It may already be started depending on your O/S and how you switched accounts.)

Then Domain\Username should be able to connect using SQLCMD, SSMS etc. using (localdb)\.\MyInstance.


I logged off and then logged in as another administrator and renamed my user profile folder's name. I switched into my account in Windows 7. There is a newly created TEMP folder as my user profile folder. I compared before & after folder structure as in picture. Plus; LocalDB instance started successfully.

localdb2.png

I logged off and renamed my username to original. Logged again & jumped into that folder:

C:\Users\MYUSERNAME\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0

And saw the error logs; Access denied!

http://pastebin.com/ASeJGqpw

Solution: Simply delete all files in v11.0 folder. Give write permision to v11.0 folder. If you can't create another instance give write permission to Instances folder.


I used to have this problem when my localdb and sql instance was installed with a different user than the current (domain user), so I fixed this by clearing the V11.0 folder and pasting the mdf and ldf files from the old path :

C:\Users\{inseryouroldusernamehere}\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\v11.0

Hope it helps.