SQL Server Lost SA Password: How to Reset It Safely

You can reset a lost SQL Server sa password if you still have another sysadmin login or authorized local Windows administrator access to the server. Start with an online reset through SQL Server Management Studio (SSMS) or sqlcmd; use single-user mode only when no SQL Server administrator login remains. Resetting the password does not repair a damaged database or restore access when the real problem is database recovery, authentication mode, or server availability.

What Losing the SA Password Means

The sa login is SQL Server’s built-in system administrator account. It has unrestricted server-level privileges, including the ability to create logins, change permissions, alter server settings, and access databases.

A lost sa password does not necessarily mean you are locked out of SQL Server. You can still recover access if any of these are true:

  • Another SQL Server login belongs to the sysadmin fixed server role.
  • A Windows account has sysadmin access through Windows Authentication.
  • You are an authorized local Windows administrator on the machine hosting SQL Server and can start the instance in single-user mode.
  • A separate break-glass administrator account exists.

Do not try to “recover” or reveal the old password. SQL Server stores password hashes, not recoverable plaintext passwords. The practical solution is to set a new password.

Also confirm that the problem is truly the sa credential. An application may be failing because it uses a different SQL login, SQL Server may be configured for Windows Authentication only, or the target database may be unavailable.

How to Reset the SQL Server SA Password

Choose the least disruptive recovery route that your current access allows.

What Access You Have Best Recovery Method SQL Server Service Impact
Another SQL Server or Windows login with sysadmin rights Reset sa in SSMS or with sqlcmd using Windows Authentication No service restart required
No SQL Server administrator login, but authorized local Windows administrator access to the host Start SQL Server in single-user mode, reset sa, then restart normally Controlled service restart required
Database is corrupt, offline, or in Recovery Pending State Diagnose and recover the database separately Password reset alone will not fix it
sa is disabled or SQL Server uses Windows Authentication only Enable the login or change authentication mode after resetting it Changing authentication mode requires a restart

An existing SQL Server administrator can reset sa online, while an authorized Windows administrator can regain SQL Server administrative access through controlled single-user startup.

Reset SA With Another Sysadmin Login

When an existing sysadmin can sign in, reset sa online; this is the safest and simplest route. Sign in with an account that is already a member of the SQL Server sysadmin fixed server role.

You can use either SSMS or sqlcmd with Windows Authentication. Both methods can reset the password without stopping or restarting SQL Server.

The following SSMS steps reset sa with a working administrator connection:

  1. Open SSMS and connect to the target instance with the working administrator account.
  2. In Object Explorer, expand Security > Logins.
  3. Right-click sa, then choose Properties.
  4. On the General page, enter and confirm a new password.
  5. Open the Status page and confirm that Login is set to Enabled if you intend to use sa.
  6. Select OK to save the change.
  7. Disconnect, then create a new connection using SQL Server Authentication, login name sa, and the new password.
  8. Run a harmless identity query to confirm the connection is using the intended account.
SELECT ORIGINAL_LOGIN(), SUSER_SNAME(), IS_SRVROLEMEMBER('sysadmin');

The result for IS_SRVROLEMEMBER('sysadmin') should be 1 when connected as sa.

The following sqlcmd steps use Windows Authentication:

Use this when a Windows account already has sysadmin rights but you prefer a command-line session.

  1. Open Command Prompt or PowerShell under the authorized Windows account.
  2. Connect to the SQL Server instance with integrated Windows Authentication. Replace SERVER\INSTANCE with the actual server and instance name.
sqlcmd -S "SERVER\INSTANCE" -E
  1. At the sqlcmd prompt, run the following command to set a new sa password: Replace NewPasswordStoredInYourVault with a unique password you will store in an approved password manager or vault.
ALTER LOGIN [sa] WITH PASSWORD = 'NewPasswordStoredInYourVault';
GO
  1. If sa is disabled, run the following command to enable it:
ALTER LOGIN [sa] ENABLE;
GO
  1. Close the session, then create a new SQL Server Authentication connection in SSMS or sqlcmd using sa and the new password.
  2. Confirm the login is a system administrator.
SELECT SUSER_SNAME(), IS_SRVROLEMEMBER('sysadmin');

If your new password contains a single quotation mark, it must be escaped as two single quotation marks inside the SQL string.

Reset SA Through Single-User Mode

Use this route only if no working SQL Server sysadmin login exists. You must be authorized to administer the Windows server that hosts the SQL Server instance.

Single-user mode allows an authorized local Windows administrator to connect as a SQL Server system administrator. It also allows only one connection, so SQL Server Agent, monitoring software, or an application can accidentally take that connection before you do.

  1. Schedule a short maintenance window and stop applications that connect to the SQL Server instance.
  2. Stop SQL Server Agent for the instance, if it is running.
  3. Open SQL Server Configuration Manager with elevated Windows permissions.
  4. Locate the target service under SQL Server Services.
  5. Open the service properties and add this startup parameter:
-mSQLCMD

The SQLCMD restriction reserves the single connection for the sqlcmd utility rather than allowing another program to claim it.

  1. Restart the SQL Server service from SQL Server Configuration Manager.
  2. Open an elevated Command Prompt or PowerShell under the authorized local Windows administrator account.
  3. Connect with sqlcmd.
sqlcmd -S "SERVER\INSTANCE" -E
  1. Reset the password.
ALTER LOGIN [sa] WITH PASSWORD = 'NewPasswordStoredInYourVault';
GO
  1. If sa is disabled, run the following command to enable it before leaving single-user mode:
ALTER LOGIN [sa] ENABLE;
GO
  1. Close sqlcmd.
  2. Return to SQL Server Configuration Manager, remove the startup parameter below, and restart the SQL Server service normally.
-mSQLCMD
  1. Start SQL Server Agent again if it was running before maintenance.
  2. Connect using sa and the new password, then confirm that the service is in normal multi-user operation.

Do not leave SQL Server in single-user mode. It is a recovery state, not a secure operating configuration.

When a Password Reset Will Not Restore Database Access

A database in Recovery Pending State requires a database recovery path. SQL Server may be unable to complete crash recovery because of unavailable files, storage failures, missing transaction-log files, insufficient disk space, or database corruption.

If the database is damaged or corrupted, resetting the sa password will not allow you to access its data. Check the SQL Server error log, Windows event logs, database file availability, disk capacity, and backup history before attempting database repair.

Avoid running destructive repair operations on the only copy of a database. Preserve the database files and take a copy when possible before trying repair or restore work.

If you are evaluating a third-party repair product, the publisher of DRS SQL Database Recovery Tool lists support for SQL Server 2012, 2014, 2016, 2017, 2019, and 2022; confirm the exact supported-version list and recovery behavior for your SQL Server release before using it on a copy of the affected files.

Check Authentication Mode and Login Status

Even after resetting sa, SQL Server configured for Windows Authentication only will reject the login. In that mode, SQL logins such as sa cannot authenticate even when their passwords are correct.

To check this in SSMS:

  1. Connect with a working Windows or SQL Server administrator account.
  2. Right-click the server name in Object Explorer and select Properties.
  3. Select Security.
  4. Check the server authentication setting.

If you need sa to sign in, select SQL Server and Windows Authentication mode. This setting requires a SQL Server service restart before it takes effect.

Also check whether the sa login is disabled:

  1. Expand Security > Logins.
  2. Right-click sa and choose Properties.
  3. Select Status.
  4. Set Login to Enabled if your organization permits use of sa.

Many organizations intentionally disable sa and use named Windows groups or dedicated administrator logins instead.

Confirm the Reset Worked

After restoring normal service operation, test the exact path that was failing.

  1. Open a new SSMS connection window.
  2. Choose SQL Server Authentication.
  3. Enter sa and the new password.
  4. Connect to the intended SQL Server instance.
  5. Run the following query.
SELECT
    SERVERPROPERTY('ServerName') AS server_name,
    ORIGINAL_LOGIN() AS original_login,
    SUSER_SNAME() AS current_login,
    IS_SRVROLEMEMBER('sysadmin') AS is_sysadmin;

Confirm all of the following:

  • server_name identifies the expected SQL Server instance.
  • original_login and current_login show sa.
  • is_sysadmin returns 1.
  • The application or maintenance task that prompted the reset can connect using its own intended credential.
  • SQL Server Agent, scheduled jobs, monitoring, and application connection strings do not depend on the old sa password.

If an application was using sa, update its secret in the application’s approved configuration store, then plan to replace that dependency with a dedicated login that has only the permissions the application needs.

Prevent Another SA Lockout

  • Keep at least one named Windows-authenticated sysadmin path available for authorized administrators.
  • Use separate named administrator accounts instead of sharing sa.
  • Store break-glass credentials in an approved password vault with controlled emergency access.
  • Document the SQL Server instance name, service name, authentication mode, and responsible owner.
  • Use a dedicated SQL login or Windows service identity for each application instead of sa.
  • Grant applications the minimum server and database permissions they need.
  • Test emergency access procedures during planned maintenance, not during an outage.

A reset is much safer when it is a documented recovery procedure rather than an improvised attempt to regain access.

Frequently Asked Questions

Can I retrieve or reveal the old SQL Server SA password?

No. SQL Server does not provide a way to reveal the existing sa password because it stores a password hash rather than the original plaintext password. Use a working sysadmin account to assign a new password, or use authorized single-user mode when no SQL Server administrator login remains.

How Do I Get the SSMS Password?

SSMS is a client application, so it does not have a separate server password to recover. It connects through Windows Authentication or a SQL Server login. If SSMS connected previously with Windows Authentication, sign in to Windows with the authorized account and connect again with Windows Authentication. If sa is the lost credential, reset the sa login in SQL Server instead of looking for an SSMS password.

Can I Reset the SA Password Without Restarting SQL Server?

Yes. SSMS or sqlcmd with Windows Authentication can reset sa without restarting SQL Server when another login already has sysadmin rights. A restart is needed only when you must use single-user mode or when you change SQL Server from Windows Authentication mode to SQL Server and Windows Authentication mode.

Why Does the New SA Password Still Not Let Me Access a Database?

The database may be offline, corrupt, inaccessible because of missing files, or in Recovery Pending State. A password reset restores server-login access; it does not repair data files, transaction logs, storage problems, or a failed recovery process. Check the SQL Server error log and recover the database from a known-good backup or an appropriate recovery process.