security - Why is it necessary to remove and then re-add a user to a SQL Server database after restoring it from a file? -


Why is it necessary to remove a user from a file after removing it and then adding a user again? / P>

If I do not do this, then I get a "user login failed" while trying to access the database using the app's username.

You have to do this to sync the database user with server login.

The SQL certifies at the first server level, then at a database level. Although database entry can have a name similar to a server login, there is no guarantee that they are the same login. (All file backups can come from a different server.)

By removing the user at the database level, you are confirming that the server login has access to the database.


Comments