SQL Login Failed Message
-
Just out the blue today I started getting this error on my Dev PC.
Cannot open database "MyDb" requested by the login. The login failed.
Login failed for user 'MicrosoftAccount\my_ms_account'.The account name is one of my Microsoft account names, and happens to be the one tied this PC's Windows 10. There IS NO SQL login with that name. There have been no DB structure changes. Today I've done typical CRUD operations via C# & Linq-To-SQL. And again, this just started this afternoon. I Googled it and [found this](https://stackoverflow.com/questions/38372613/sql-srv-2016-login-failed-for-user-microsoftaccount). I'm hesitant to try that fix until I know what's happening. For now, if I log off and back on it seems to fix it, but then I have to close and reopen everything. Anyone know what this is?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Just out the blue today I started getting this error on my Dev PC.
Cannot open database "MyDb" requested by the login. The login failed.
Login failed for user 'MicrosoftAccount\my_ms_account'.The account name is one of my Microsoft account names, and happens to be the one tied this PC's Windows 10. There IS NO SQL login with that name. There have been no DB structure changes. Today I've done typical CRUD operations via C# & Linq-To-SQL. And again, this just started this afternoon. I Googled it and [found this](https://stackoverflow.com/questions/38372613/sql-srv-2016-login-failed-for-user-microsoftaccount). I'm hesitant to try that fix until I know what's happening. For now, if I log off and back on it seems to fix it, but then I have to close and reopen everything. Anyone know what this is?
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
Do you normally connect from an elevated process? If so, the
BUILTIN\Administrators
login would apply, and you wouldn't need a separate login for your account. But if you then tried to connect from a non-elevated process, you wouldn't be part of the Administrators group. The SQL setup normally has a step where it adds the current user to thesysadmin
role so that you don't have to elevate to connect. Was SQL installed by a different user, or did you prevent it from adding your user account? Have you switched from a local account to a Microsoft account recently? Did the restart fix it permanently, or did the problem come back?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Do you normally connect from an elevated process? If so, the
BUILTIN\Administrators
login would apply, and you wouldn't need a separate login for your account. But if you then tried to connect from a non-elevated process, you wouldn't be part of the Administrators group. The SQL setup normally has a step where it adds the current user to thesysadmin
role so that you don't have to elevate to connect. Was SQL installed by a different user, or did you prevent it from adding your user account? Have you switched from a local account to a Microsoft account recently? Did the restart fix it permanently, or did the problem come back?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Richard Deeming wrote:
Do you normally connect from an elevated process?
I used Trusted Connection
Richard Deeming wrote:
Was SQL installed by a different user, or did you prevent it from adding your user account?
No
Richard Deeming wrote:
Have you switched from a local account to a Microsoft account recently?
No
Richard Deeming wrote:
Did the restart fix it permanently, or did the problem come back?
It reoccurs
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Do you normally connect from an elevated process? If so, the
BUILTIN\Administrators
login would apply, and you wouldn't need a separate login for your account. But if you then tried to connect from a non-elevated process, you wouldn't be part of the Administrators group. The SQL setup normally has a step where it adds the current user to thesysadmin
role so that you don't have to elevate to connect. Was SQL installed by a different user, or did you prevent it from adding your user account? Have you switched from a local account to a Microsoft account recently? Did the restart fix it permanently, or did the problem come back?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Well, I just noticed that my database was in Singlr User Mode. I set it back to Multi User and the problem no longer seems to appear.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.