Tagged: The server principal “XYZUSER” is not able to access the database “YourDBName” under the current security context

The server principal “XYZ\USER” is not able to access the database “YourDBName” under the current security context

My Development team contacted me and said they are not able to access database  “The server principal “XYZ\USER” is not able to access the database “YourDBName” under the current security context”

when I looked into server server I found –

  1. Login was there and access was granted.
  2. When I looked into database I found user was disable ( Red down arrow mark )

2

Here are two solutions –

  1. Most of the people recommended to recreate use by deleting and reading into database.

But main reason why it’s disabled because user is not having connect permission to database.

  1. if you grant connect permission it will resolve your issue.

use [YourDBName]

go

grant connect to [xyz\user]

1