Clear, practical technology insights About · Contact

How to create users in MS SQL Server

The user here is an account on MS SQL Server to access the database (database).

Author: David Pac2 minutes read

The user here is an account on MS SQL Server to access the database (database).

Users can be created in 1 of 2 ways below.

Method 1: Use T-SQL

Syntax for creating users in MS SQL Server.

 Create user for login 

For example:

To create a user named TestUser with the login name TestLogin on TestDB database , run the query below.

 create user TestUser for login TestLogin 

Method 2: Use SQL Server Management Studio SSMS

Note: First, you need to create Login with any name before creating user account. Use Login as TestLogin.

Step 1 : Connect to SQL Server and expand the database directory. Then open the database named TestDB, where we will create user accounts, find the Security folder . Find the Users or Logins folder (on the new SQL Server version) and select New Login. Then the screen below will appear.

images 1 of How to create users in MS SQL Server
New user creation screen for MS SQL Server

Step 2: Enter the TestUser name for the username and select the Login name named TestLogin as shown below.

images 1 of How to create users in MS SQL Server
Create a new user account

Step 3: Click OK to finish. Refresh the folder, you will see the newly created username.

images 1 of How to create users in MS SQL Server
Successfully created new users on MS SQL Server

Previous article: How to recover the database in MS SQL Server

Next lesson: How to decentralize access in MS SQL Server

Was this article helpful?

Your feedback helps us improve.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.