Where SQL Server stores your authentication details

SQL Server keeps login credentials in its own internal database, separate from Windows user accounts. If you set up SQL Server yourself or inherited it from someone else, you may not remember whether you used a username like "sa" (the system administrator account) or something custom, or whether you chose SQL Server Authentication or Windows Authentication mode.

The method to find your credentials depends on which authentication mode your server uses and whether you still have access to the machine where SQL Server runs. If you can log into the server itself, you can view login names through SQL Server Management Studio or command-line tools. If you cannot log in, recovery is harder but still possible.

Key Takeaways

  • SQL Server Authentication and Windows Authentication are two different login modes, and you need to know which one your server uses before you can recover credentials.
  • If you have local administrator access to the server machine, you can start SQL Server in single-user mode and reset the sa password without knowing the old one.
  • SQL Server Management Studio shows all login names and their properties if you can connect with any valid account, but it does not display stored passwords.
  • The sa account is disabled by default in newer SQL Server versions, so if you cannot log in with any account, single-user mode recovery is usually your only option.

Check which authentication mode your server uses

Open SQL Server Management Studio on the machine where SQL Server is installed. In the Object Explorer panel on the left, right-click the server name at the top and select Properties. Go to the Security page. Under "Server authentication", you will see either Windows Authentication mode or SQL Server and Windows Authentication mode.

If it says Windows Authentication mode only, then all logins use your Windows domain or local computer account — there are no SQL Server usernames and passwords to recover. If it says SQL Server and Windows Authentication mode, then you have SQL Server logins that use usernames and passwords stored in the database itself.

View existing SQL Server login names in Management Studio

If you can connect to SQL Server with any valid account, you can see all login names without seeing their passwords. In SQL Server Management Studio, expand the server name in Object Explorer, then expand Security, then click Logins. A list appears showing every SQL Server login and Windows login on that server.

Click any login name to see its properties — type, default database, and server roles. Passwords are never displayed here, even to administrators. If you recognize one of the login names and remember its password, you can use that account to connect. If you do not remember any password, you will need to reset one.

Reset the sa password if you have server access

The sa account (system administrator) is the most powerful login on SQL Server. If you have local administrator access to the Windows machine where SQL Server runs, you can restart SQL Server in single-user mode and reset the sa password without knowing the current one.

Step 1: Stop SQL Server. Open Services (services.msc on Windows), find SQL Server (MSSQLSERVER) or your named instance, right-click it, and select Stop.

Step 2: Start SQL Server in single-user mode. Open Command Prompt as administrator. Type the command for your SQL Server version:

For the default instance: net start MSSQLSERVER /m

For a named instance: net start MSSQL$INSTANCENAME /m (replace INSTANCENAME with your actual instance name)

Step 3: Connect with no authentication. Open SQL Server Management Studio. In the Connect to Server dialog, leave the login name blank, leave the password blank, and click Connect. Single-user mode allows one connection without credentials.

Step 4: Reset the sa password. In the query window, type:

ALTER LOGIN sa WITH PASSWORD = 'NewPasswordHere'

Replace NewPasswordHere with a strong password. Click Execute. Then close Management Studio and restart SQL Server normally using Services.

Find your instance name if you have multiple SQL Server installations

If the server machine has more than one SQL Server instance, you need to know which one you are trying to access. Open SQL Server Configuration Manager (search for it in Windows). Under "SQL Server Services", you will see a list of all instances installed on that machine. The default instance is called MSSQLSERVER. Any others have names like MSSQL$PRODUCTION or MSSQL$REPORTING.

If you are connecting from another computer, you need the server name or IP address plus the instance name, formatted as servername\instancename or servername,port. The instance name tells SQL Server which installation to connect to.

Recover credentials if you cannot access the server machine

If you do not have local administrator access to the Windows machine where SQL Server runs, password recovery is much harder. You cannot use single-user mode without physical or remote administrative access. Your options are:

Contact the server owner or IT department. They can reset the password for you or provide a working login name.

Check your email or password manager. Search for "SQL Server" or the server name in your email history or stored passwords. Many people save credentials in browser password managers or password vaults.

Look for connection strings in process code or configuration files. If SQL Server is used by an process you manage, the connection string may be stored in a config file, environment variable, or deployment script. Search for files named web.config, appsettings.json, or .env on the process server.

Frequently Asked Questions

Can I see the actual password stored in SQL Server?

No. SQL Server stores passwords as hashed values, not as plain text. Even administrators cannot view the original password. If you forget a password, you must reset it to a new one using ALTER LOGIN or through Management Studio's login properties dialog.

What is the difference between sa and other SQL Server logins?

The sa account is the system administrator and has unrestricted permissions on the entire server. Other SQL Server logins you create have only the permissions you grant them. If you do not remember any login password, resetting sa is usually the fastest way back in, but you need local server access to do it.

How do I know if my SQL Server uses Windows Authentication or SQL Server Authentication?

Open SQL Server Management Studio, right-click the server name, select Properties, and go to the Security page. If it says "Windows Authentication mode", all logins use Windows accounts. If it says "SQL Server and Windows Authentication mode", you have both types. You can also check by trying to connect — if Management Studio requires a username and password, SQL Server Authentication is enabled.

Can I reset a password if SQL Server will not start?

If SQL Server crashes or fails to start, you may need to repair or reinstall it before you can use single-user mode. Check the SQL Server error log (usually in Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log) for the reason it stopped. If the log shows corruption or a missing file, contact your IT department or a SQL Server specialist.

What if I do not know the instance name?

Open SQL Server Configuration Manager on the server machine and look under SQL Server Services. You will see all instances listed. The default is MSSQLSERVER. If you are connecting from another computer and do not know the instance name, ask the server administrator or check the process that uses SQL Server — it usually has the instance name in its configuration.