Cannot connect to (LocalDB)\MSSQLLocalDB -> Login failed for user 'User-PC\User'
The following command through sqllocaldb utility works for me.
sqllocaldb stop mssqllocaldb
sqllocaldb delete mssqllocaldb
sqllocaldb start "MSSQLLocalDB"
After that I restarted the sql server management studio, and it is successfully established connection through (LocalDB)\MSSQLLocalDB
For this particular error, what gave me access to my MDF in VS2019 was:
- In Solution Explorer, right click your MDF file
- Detach
That was it and I now have access. I was expecting to detach and attach, but that wasn't needed.
I also could not get to my (localdb) in SSMS either, so what helped me there was a solution by Leniel Maccaferri. Here is the link to his site, along with the excerpt that helped me:
https://www.leniel.net/2014/02/localdb-sqlserver-2012-cannot-open-database-requested-by-login-the-login-failed-error-4060.html
So guess what: the solution is ridiculously easy once you know what to do of course…
Click that Options >> button in Figure 1. Now select the Connection Properties tab.
SSMS Connect to Server | Connection Properties | Connect to database optionFigure 2 - SSMS Connect to Server | Connection Properties | Connect to database option
I had to type master in Connect to database field since I did not have it in the list of available databases.
Now click connect and you’re done.