Ways to log in database on MS SQL Server

Logging in is a simple way to access SQL Server, as well as using your ID and password to log in to Windows or your email account. SQL Server has 4 types of login.

  1. According to Windows login information
  2. Specified specifically for SQL Server
  3. Created under Certificate certificate
  4. Created by Asymmetric Keys

This tutorial will only focus on how to log in with Windows Credentials and specify it for SQL Server.

Method 1 helps you log into SQL Server with your Windows username and password. If you want to create another username and password, use the second method.

To create, change or delete SQL Server login information, there are two ways

  1. Use SQL Server Management Studio
  2. Use T-SQL

Method 1: Log in to the database using SQL Server Management Studio

Step 1 : After connecting to SQL Server Instance, open the Logins folder as shown in the image below.

Ways to log in database on MS SQL Server Picture 1
Open the Logins folder on SQL Server Management Studio

Step 2: Right-click Logins and select Newlogin, the screen below will appear.

Ways to log in database on MS SQL Server Picture 2
Enter login information

Step 3: Enter the name and password, confirm the password again as shown in the image above and click OK. Then, new login information will be created as shown in the image below.

Ways to log in database on MS SQL Server Picture 3
New login information created

Method 2: Log in the database using T-SQL Script

To create a login name of TestLogin and a password of P @ ssword, you only need to run 2 queries below.

 Create login yourloginname with password='yourpassword' 
 Create login TestLogin with password='P@ssword' 

Previous article: Managing MS SQL Server with Management Studio

Next article: How to create a database on MS SQL Server

5 ★ | 2 Vote

May be interested

  • How to choose a database in MS SQL ServerHow to choose a database in MS SQL Server
    you can select the database to manipulate in one of the ways below.
  • Compare the performance of MongoDB and SQL Server 2008Compare the performance of MongoDB and SQL Server 2008
    in the following article, we will point out the difference in performance of the relatively new database management system, which is mongodb and one of the popular systems like sql server (mysql or oracle). most of the data is given here in the form of charts, so we can easily imagine the advantages and disadvantages of mongodb as well as other database management systems.
  • Microsoft Windows PowerShell and SQL Server 2005 SMO - Part 10Microsoft Windows PowerShell and SQL Server 2005 SMO - Part 10
    in part 10, i will show you how to use powershell scripts in conjunction with smo and parameters to create sql server scripts. creating sql server scripts is an important task for administrators and sql server database development professionals.
  • Use and manage Database MailUse and manage Database Mail
    sql server 2005 has a small mail system called database mail. as an improved feature in sql mail compared to earlier versions of sql server, database mail is a mail queue system. email messages are stored in an internal queue
  • Restore SQL Server from Transaction LogRestore SQL Server from Transaction Log
    transaction log (also known as database log or binary log) is an action history that is executed by the database system to ensure acid properties when the system fails.
  • How to install SQL Server databaseHow to install SQL Server database
    one of the most important things you must do in sql server 2008 is to install data and log files
  • How to create users in MS SQL ServerHow to create users in MS SQL Server
    the user here is an account on ms sql server to access the database (database).
  • Upload multiple XML files into XML data type columnsUpload multiple XML files into XML data type columns
    sql server database administrators often have some needs such as importing multiple files into a table in the database. this article will discuss how to upload multiple files (especially xml files) into the xml data column of the sql server database.
  • Secure programming of Access databaseSecure programming of Access database
    almost everyone who uses a microsoft access application uses one of the (or all) of the following ways to protect the database (database), to lock their hands and lock the curious employees:
  • Attach database in Microsoft SQL Server 2008Attach database in Microsoft SQL Server 2008
    this article will illustrate the different usage methods of the 'for attach' clause to overcome the limitations encountered when using sp_attach_db and sp_attach_single_file_db.