MS SQL Server – Login Database

Login Database

A login database is a simple credential for accessing SQL Server. For example, you provide your username and password when logging on to Windows or even your e-mail account. This username and password build up the credentials. Therefore, credentials are simply a username and a password.

SQL Server allows four types of logins βˆ’

  • A login based on Windows credentials.
  • A login specific to SQL Server.
  • And login mapped to a certificate.
  • A login mapped to asymmetric key.

In this tutorial, we are interested in logins based on Windows Credentials and logins specific to SQL Server.

Logins based on Windows credentials allow you to log in to SQL Server using a Windows username and password. If you need to create your own credentials (username and password,) you can create a login specific to SQL Server.

To create, alter, or remove a SQL Server login, you can take one of two approaches βˆ’

  • Using SQL Server Management Studio.
  • Using T-SQL statements.

Following methods are used to create Login βˆ’

First Method – Using SQL Server Management Studio

Step1 βˆ’ After connecting to SQL Server Instance, expand the logins folder as shown in the following snapshot.

Login Database

Step2 βˆ’ Right-click on Logins, then click New login and the following screen will open.

Login Database

Step3 βˆ’ Fill in the Login name, Password, and Confirm password columns as shown in the above screen and then click OK.

Login will be created as shown in the following image.

Second Method – Using T-SQL Script

Create login yourloginname with password='yourpassword'

To create a login name with TestLogin and password β€˜P@ssword’ run below the following query.

Create login TestLogin with password='P@ssword'

In this guide, we will learn about the login database in SQL Server. To know more click here.

This Post Has 2 Comments

Leave a Reply