Trying to add a new SQL Server user throws the error “is not a valid login or you do not have permission”

permissionssql-server-2012user-accounts

I am trying to add a new user to an SQL Server 2012 database using SQL Server Management Studio. I right-click and select 'Add User' under Security -> Users, fill out the user information, and click OK. Management Studio throws the the error message "is not a valid login or you do not have permission”.

How can I add this user?

Best Answer

Before adding a user one must first create a login. Logins can only be created in the servers Security-folder (not in the databses Security).

So the login can be created under <server>/Security -> Right-Click -> New -> Login....

A user with the same name and settings will automatically be added to the databases selected in the User Mapping tab when creating the login.

  • If the user wasn't already created you can create it via <server>/<database>/Security -> Right-Click -> New -> User. Note that the names of the users and logins must match.
  • If you would like to manage the users settings when it was automatically added you can change them in <server>/<database>/Security/Users/<user> -> Right-Click -> Properties.