How to Reset SA Password In SQL Server with Different Methods

Daniel Jones | March 16th, 2019 | SQL, SQL Server 2016 |


In this article we will look at the procedure to Reset SA Password In SQL Server, if the SA password was forgotten or there are no users with administrative rights to MS SQL 2016. We will show how to reset the password of the SA account, and, if necessary, provide the necessary Windows account with MSSQL administrator rights.


Situations when an SA user is lost / forgotten on MS SQL DBMS happen quite often. As a rule, the option of reinstalling SQL and reconnecting the database is not considered, since in this time, the configuration parameters stored in the system master database will be lost.

SQL Server provides much more convenient access recovery functionality. The fact is that members of the local group of administrators of the system on which SQL Server is installed have full authority on a DBMS running in single-user mode.

By running SQL Server in single user mode, you can change the password of the SA account or grant the administrative rights to the desired Windows account.

Note: Recall that starting with SQL Server 2016, the local group of administrators of the system on which SQL Server is installed is not added by default to the sysadmin role on the SQL server.

The procedure for starting SQL Server 2016 in single-user mode and restoring access is as follows (the main condition is that you must have administrator rights on the system on which MSSQL is installed)

Steps to Reset Password In SQL Server 2016

Stop the service of the necessary SQL Server instance (in our case the name of the instance MSSQL is SQLEXPRESS ): net stop MSSQL$SQLEXPRESS

Open the registry editor (regedit.exe) and go to the parameters section to start the SQL service: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\ MSSQL$SQLEXPRESS

Changing the value ImagePath , adding as an argument sqlservr.exe key « -m ». In our example, we got the following value: “C:\Program Files\Microsoft SQL Server\MSSQL13.SQLEXPRESS\MSSQL\Binn\sqlservr.exe” -m -s SQLEXPRESS

We start the SQL Server service: net start MSSQL$SQLEXPRESS

SQL is now running in single user mode and allows any member of the local computer administrators group to connect to an instance of SQL Server with sysadmin privileges.

Using SQL Server Management Studio, change the SA password or provide the sysadmin role to the required Windows account.

Tip: You can perform this operation from the sqlcmd command line: EXEC sp_addsrvrolemember ‘DOMAIN\Username’, ‘sysadmin’;

It remains only to stop the SQL service, change the ImagePart key value to the original one, removing the “-m” attribute ( “C: \ Program Files \ Microsoft SQL Server \ MSSQL13.SQLEXPRESS \ MSSQL \ Binn \ sqlservr.exe” -sSQLEXPRESS” ) and start SQL Server in normal mode.

Alternate Method to Reset SA Password In SQL Server

In case, if you unable to change SA password in SQL Server with above solution, then do not worry about it. We have another robust solution named as SysTools SQL Password Recovery , which helps you in changing the SA password using Master.mdf file in few simple clicks.

For this, you need to stop your SQL server services.

  • Open Services and right click on SQL Server then Click on Stop SQL server services
  • Go to the default location of master.mdf file and make a backup copy of both (master.mdf & mastlog.ldf) in another location of your system.
  • Now Download SysTools SQL password recovery and launch in your machine.
  • Click on Browse button to load the master.mdf from default location into the software
  • After successfully loading the master.mdf, software will scan the file and display the list of Username created on the Server.
  • Click on the User Name for which you want to reset the password and click on Reset Password button
    software will again warn you to take backup of master.mdf and mastlog.ldf (Make sure you have taken a backup of both these files)
  • Now, set a new password for your User and click on OK
  • when the password is changed successfully, A message will pop-up. Click OK

Next Step

Go to Services, Right click on SQL server and click on Start to restart the SQL Server Services.
When the process to reset SA password in SQL Server is done, launch SQL Server Management Studio and log in via new password to verify it.

Review Date
Reviewed Item
Know How to Reset SA Password In SQL Server - Step by Step
Author Rating