Sql-server – SQL Server Authentication

authenticationsql server

I am able to access a database using the Windows Authentication method in DBeaver. However, when I switch to different account in Windows and I would like to access the datebase, I used SQL Server Authentication method, it keeps giving me error. How should be the username format?

Moreover, how can I add another Windows account to the database so I access the database without the need to switch the Windows account everytime.

Best Answer

There are two modes of authentication on SQL Server as you can see below:

Modes of Authentication

  1. Windows Authentication - If only this is enabled then, you can only create domain account(windows account) and login will have format like --> Domain_Name\Login_Name

  2. SQL Server and Windows Authentication - Also called mixed more, if this is enabled then you can either have windows authenticated(domain account) or SQL login.

The difference between above two is - You need to explicitly provide password for the SQL authentication whereas in the Windows authentication if you have already logged in with same domain account then, no need to provide password and other policies are taken care at DC(Domain Controller or Active Directory) level.

In case, you have logged in to windows using account A(for example) and want to use account B, you can do so by doing CTRL+SHIFT+Right Click and choose "Run as different user" for the application and you may input your ID(with domain i.e. Domain_Name\Login_Name) and password for account B as below:

Run as Different User

For creating a new windows authentication account and other relevant details, you may refer below link:

https://www.tutorialgateway.org/create-windows-login-in-sql-server/

I hope above helps.