sodcalculator

10 Tech How-To

How to Change SA Password in SQL Server

Guide 10-4793 · Updated · Step by step

This guide walks you through changing the SQL Server system administrator (SA) password using SQL Server Management Studio (SSMS) and T-SQL. You’ll need Windows administrator rights on the server and either Windows Authentication access or the current SA password to complete the steps.

What You’ll Need

  • Access to the SQL Server instance (local or remote) with permissions to alter logins.
  • SQL Server Management Studio (SSMS) installed, or a query tool like Azure Data Studio.
  • The current SA password if you plan to log in as SA, or a Windows account with sysadmin role membership.
  • Permission to restart the SQL Server service if you need to use single-user mode (for emergency recovery).

Step-by-Step

  1. Open SQL Server Management Studio. Launch SSMS from the Start menu. In the “Connect to Server” dialog, choose your server type (Database Engine), enter the server name, and select “Windows Authentication” if you have admin rights. Click “Connect.”
  2. Locate the SA login. In Object Explorer, expand the server node, then expand “Security,” and then “Logins.” Right-click on “sa” and select “Properties.”
  3. Set the new password. In the “Login Properties” dialog, under the “General” page, you’ll see the password fields. Enter the new password in the “Password” box and again in “Confirm Password.” Ensure the password meets your organization’s complexity policy (typically at least 8 characters with upper/lowercase, numbers, and symbols).
  4. Choose password policy options. Below the password fields, you’ll see checkboxes: “Enforce password policy,” “Enforce password expiration,” and “User must change password at next login.” Select these based on your security requirements. For a service account, it’s common to enforce the policy but disable expiration.
  5. Apply the change. Click “OK” to save the password. SSMS will execute the ALTER LOGIN statement. If successful, you’ll see a confirmation message (or no error).
  6. Verify the new password. Disconnect from the server (right-click the server in Object Explorer and choose “Disconnect”). Reconnect using SQL Server Authentication, enter “sa” as the login, and type the new password. If it connects, the change was successful.

Alternative using T-SQL: Instead of steps 2-5, you can open a new query window and run:

ALTER LOGIN sa WITH PASSWORD = 'NewStrongPassword123!';
GO

This achieves the same result. Make sure to replace the placeholder with your actual password.

Common Mistakes

  • Forgetting to enable SQL Server Authentication. If the server is in Windows Authentication mode only, you cannot log in with SA. You must enable Mixed Mode (SQL Server and Windows Authentication) via server properties or during installation.
  • Using a weak password. A short or simple password may be rejected if the “Enforce password policy” checkbox is checked. Use a strong password with at least 12 characters.
  • Not confirming the password. Typing the password differently in the two fields causes an error. Double-check both entries.
  • Confusing SA with other logins. SA is a specific system login. Changing a user database login won’t affect SA.
  • Locking yourself out. If you change SA and then lose the password, you’ll need to use single-user mode or another sysadmin login to recover. Ensure you have a backup plan.

Tips

  • Use a password manager. Generate a random, long password and store it securely. Never reuse passwords across systems.
  • Document the change. Record the date and who changed the password in your organization’s IT documentation.
  • Consider disabling SA if not needed. If applications don’t use SA, you can disable it (right-click sa → Properties → Status → Login: Disabled). Better yet, use Windows Authentication or a dedicated service account with least privilege.
  • Test after change. Always verify that applications connecting with SA still work, or update their connection strings if you changed the password.
  • Use a strong password policy. For production, enforce complexity and expiration, but be aware that expiration may break unattended services.

Troubleshooting

  • Error: “Cannot alter the login ‘sa’, because it does not exist.” This means the SA login has been renamed or removed. Check the logins list; you may need to create a new login with sysadmin role or use another admin account.
  • Error: “The password does not meet the policy requirements.” Strengthen the password to include uppercase, lowercase, digits, and special characters. Check the Windows password policy on the server.
  • Can’t connect to change the password. If you forgot the current SA password and don’t have Windows admin rights, you’ll need to start SQL Server in single-user mode. Stop the SQL Server service, then start it with the -m parameter from the command line (as a local admin). Connect using Windows Authentication (you’ll be the only connection), then change the SA password. Restart the service normally.
  • SA login is disabled. If SA is disabled, you can’t log in with it. Enable it by connecting with Windows Authentication, right-click sa → Properties → Status → Login: Enabled.
  • Password change works but applications fail. Update the connection strings in all applications that use SA. Also check if the application uses a different login.

Frequently Asked Questions

Can I change the SA password without SSMS?

Yes, you can use T-SQL in any query tool (like sqlcmd) or PowerShell with the Invoke-Sqlcmd cmdlet. The ALTER LOGIN statement works the same.

What is the default SA password?

There is no default. During SQL Server installation, you are prompted to set a password for SA. If you chose Windows Authentication mode, SA may be disabled and have no password set.

How do I enable SQL Server Authentication mode?

Right-click the server in SSMS, select Properties → Security, and under “Server authentication,” choose “SQL Server and Windows Authentication mode.” Restart the service for the change to take effect.

Why can’t I log in with SA after changing the password?

Check that SQL Server Authentication is enabled, the login is not disabled, and the password is correct. Also ensure the server allows remote connections if you’re connecting from another machine.

Is it safe to use SA for applications?

It’s not recommended. SA has full administrative rights. Use a dedicated login with only the necessary permissions for each application.

What if I lose the SA password?

If you have Windows admin rights, you can start SQL Server in single-user mode and reset the password. If not, you may need to reinstall or contact your system administrator.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →