Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Login Failed Message

SQL Login Failed Message

Scheduled Pinned Locked Moved Database
databasecsharphelplinqcom
4 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    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.

    Richard DeemingR 1 Reply Last reply
    0
    • K Kevin Marois

      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.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      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 the sysadmin 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

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      K 2 Replies Last reply
      0
      • Richard DeemingR Richard Deeming

        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 the sysadmin 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

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • Richard DeemingR Richard Deeming

          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 the sysadmin 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

          K Offline
          K Offline
          Kevin Marois
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups