Instagram
youtube
Facebook
Twitter

MS SQL Server- Login Database

MS SQL Server Login Database

  • SQL Server login database is using username and password as credentials to access SQL Server.
  • There are basically two approaches to creating, altering, or removing a SQL login: Using SQL Server Management Studio and using T-SQL.

Using SQL Server Management Studio(SSMS)

  • Open SQL Server Management Studio.
  • In Object Explorer, expand the folder and find the security folder.
  • Right-click on the security folder then select new and then login.
  • After clicking on login, a new dialog box appears. Find the login name by clicking on a search a dialog box will appear to enter the object name according to the object type. refer https://docs.microsoft.com/en-us/previous-versions/orphan-topics/ws.11/dn789205(v=ws.11)?redirectedfrom=MSDN 
  • Click on Ok, again click on OK to get window authentication.
  • For SQL Server authentication, select  SQL Server authentication and Enter the password and then again enter the same password in confirm password.
  • Select Mapped to certificate to associate the login with a stand-alone security certificate and then select the name of the certificate from the list.

  • Select Mapped to asymmetric key to associate the login with a stand-alone asymmetric key and then select the name of the key from the list.

  • Select the Mapped to Credential check box to associate the login with a security credential, and then either select a credential from the list or select Add to create a new credential and also have  Remove option

  • From the Default database list and Default language list, select a default database 'Master' for the login and select language as 'default'.

  • Click OK

Using Transact-SQL

Window Authentication

  • Select new Query on the standard bar.
  • Type the following query and select the query and click on execute on the standard bar.
CREATE LOGIN [<domainName>\<loginname>] FROM WINDOWS;
GO

SQL Server Authentication

  • Select new Query on the standard bar.
  • Type the following query and select the query and click on execute on the standard bar.
CREATE LOGIN Guest WITH PASSWORD='Guest@123' MUST_CHANGE, CREDENTIAL=Restrictedfaculty;
GO

After creating a login now you can create a database and perform other operations.