Where SQL Server stores your login credentials

SQL Server authentication usernames and passwords are not stored in one central place the way your SSH credentials might be. Instead, they live in the SQL Server instance itself — the database software running on your machine or a remote server. When you set up SQL Server, you create login accounts directly in the database engine, and those credentials are what you use to connect to databases.

The method to find or reset these credentials depends on whether you still have access to the server, whether you remember the password, and which version of SQL Server you are running. Unlike SSH keys that sit in a file you can read, SQL Server passwords are hashed and stored in the system databases, so you cannot straightforward view them in plain text. You can reset them, confirm that a login exists, or create a new one if you have the right access level.

Key Takeaways

  • SQL Server logins are stored inside the database engine itself, not in a file or configuration document you can browse.
  • If you have local administrator access to the Windows machine running SQL Server, you can reset any SQL Server password without knowing the old one.
  • SQL Server Management Studio (SSMS) is the standard tool for viewing existing logins and resetting passwords, but you need to connect first.
  • If you cannot connect to SQL Server at all, you may need to restart it in single-user mode or use command-line tools to regain access.
  • The sa (system administrator) account is the default high-level login, but it may be disabled or renamed depending on your setup.

Checking what logins exist using SQL Server Management Studio

If you can already connect to your SQL Server instance with any account that has administrative permissions, the fastest way to see what logins exist is through SQL Server Management Studio (SSMS). Open SSMS, connect to your server instance, and in the Object Explorer panel on the left, expand the server name, then expand Security, then click Logins. You will see a list of all login accounts on that instance.

From this list, you can see the login name but not the password itself — passwords are one-way hashed and cannot be read back out. If you need to use a specific login and do not remember its password, you will need to reset it rather than retrieve it. Right-click the login name, select Properties, go to the General tab, and you can change the password there without knowing the old one.

Resetting a SQL Server password when you have admin access

If you have Windows administrator access to the machine running SQL Server, you can reset any SQL Server login password. In SQL Server Management Studio, right-click the login you want to reset, select Properties, and go to the General tab. Enter a new password in the Password field, confirm it in the Confirm Password field, and click OK. The change takes effect when ready.

If you do not have SSMS installed or cannot connect to the server through it, you can reset the sa password using the command line. Open Command Prompt as administrator, navigate to your SQL Server installation folder (usually C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn or similar), and run a command like sqlcmd -S localhost -U sa -P oldpassword to connect, then use the ALTER LOGIN command to change it. The exact path and version number depend on which SQL Server version you have installed.

Finding the sa account and checking if it is enabled

The sa (system administrator) account is the default superuser login in SQL Server, similar to root on Linux. During installation, you set a password for sa, but depending on your setup, this account might be disabled, renamed, or have a password you no longer remember. To check whether sa exists and is enabled, open SQL Server Management Studio, expand Security > Logins, and look for a login named sa.

If sa is listed, right-click it and select Properties. On the General tab, you can see the login name. On the Status tab, check whether Login is set to Enabled or Disabled. If it is disabled, you can enable it and set a new password at the same time. If sa does not appear in the list at all, it may have been deleted during installation or renamed to something else — check with whoever set up the server originally.

Recovering access when you cannot connect at all

If you cannot connect to SQL Server with any login and do not have another way in, you will need to restart SQL Server in single-user mode. This mode allows only one connection at a time and bypasses normal authentication, letting you connect as the system administrator. Stop the SQL Server service (use Services.msc on Windows), then restart it with the -m flag from the command line or SQL Server Configuration Manager.

Once SQL Server is in single-user mode, open Command Prompt as administrator and run sqlcmd -S localhost with no username or password. You will connect as the system user. From there, you can reset the sa password or any other login using the ALTER LOGIN command. After you finish, restart SQL Server normally to exit single-user mode. Be aware that single-user mode disconnects all other users, so do this only when no one else is using the server.

Locating credentials in configuration files or documentation

If you did not set up SQL Server yourself, the original credentials might be documented somewhere. Check any setup notes, installation scripts, or documentation left by the previous administrator. Some organizations store SQL Server credentials in a password manager, a shared document, or a deployment script used during setup.

If the server was set up through a hosting provider or cloud service, log into that provider's control panel and look for database credentials or connection strings. Many hosting providers display the default sa password or a generated password in the account dashboard after installation. If you set up the server yourself and used a script or template, check the script for hardcoded credentials or look in your email for the installation confirmation.

Understanding the difference between Windows and SQL Server authentication

SQL Server supports two authentication modes: Windows authentication and SQL Server authentication. Windows authentication uses your Windows user account and password — if you are logged into Windows as an administrator on the machine running SQL Server, you can often connect to SQL Server without a separate login. SQL Server authentication uses logins created directly in SQL Server, like sa, and requires a username and password you provide when connecting.

If you are trying to find credentials and the server is set to Windows authentication only, there may be no separate SQL Server login to find — you straightforward use your Windows account. If the server is set to mixed mode (both Windows and SQL Server authentication), both methods work. You can check which mode is active by right-clicking the server name in SQL Server Management Studio, selecting Properties, and looking at the Server Authentication setting on the Security page.

Frequently Asked Questions

Can I see the actual password for a SQL Server login?

No. SQL Server stores passwords as one-way hashes, which means they cannot be read back out or decrypted. If you need to use a login and do not remember the password, you must reset it to a new one instead. Only someone with administrative access to the SQL Server instance can reset a password.

What is the default sa password?

There is no universal default. During SQL Server installation, you set the sa password yourself. If you did not set one and left it blank, or if you cannot remember what you set, you will need to reset it using the methods described above — either through SQL Server Management Studio if you have admin access, or by restarting in single-user mode.

How do I know which SQL Server version I have?

Open SQL Server Management Studio and connect to your server. In the Object Explorer, right-click the server name and select Properties. The Server Version field shows the version number. Alternatively, open Command Prompt and run sqlcmd -S localhost -Q "SELECT @@VERSION" to see the version without opening SSMS.

What if I have access to the Windows machine but not to SQL Server Management Studio?

You can use the command-line tool sqlcmd instead. Open Command Prompt as administrator and run commands like sqlcmd -S localhost -U sa -P password to connect and execute SQL queries. This method works on any machine with SQL Server installed, even if SSMS is not present.

Can I reset the sa password if I do not have Windows administrator access?

Not directly. Resetting a SQL Server login requires either a connection to SQL Server with an account that has administrative permissions, or Windows administrator access to the machine running SQL Server. If you have neither, you will need to contact whoever administers the server or the hosting provider.