How to Reset SQL Server 2016 / 2014 Forgotten SA Password
What if your SQL Server password is misplaced or forgotten? Need to help a friend or relative reset an unknown SA password on a SQL instance? Typing the wrong password and end up locking out the SA account? How to unlock SQL Server login without reinstalling?
As a SQL Server database administrator (DBA), you must know how to reset lost SA password. Most of users rely solely on the SA login for all admin tasks, losing SA login can cause a big trouble. So here I'm going to walk you through the process of resetting forgotten SA password in SQL Server 2016 and 2014, by using the password recovery software - SQL Server Password Changer.
Preparing for recovery
SQL Server logins and passwords are stored in the master database (master.mdf). Before resetting SA password, we have to find out where the master.mdf file is stored and stop the SQL Server service. Here's how:
- Open SQL Server Configuration Manager. Once we click on SQL Server Services on left, we can see all services on right pane.
To stop SQL Server service, right-click on the SQL Server service and select Stop from the drop-down menu.
- Once SQL Server service is stopped, right-click the SQL Server Service on the right side panel and choose Properties from the drop down menu.
In SQL Server Properties screen, click the Advanced tab. The Data Path field indicates where your SQL Server database files are stored.
Browse to the Data Path folder in Windows Explorer, you can see multiple .mdf files, including master.mdf. By default, SQL Server 2016 stores the master.mdf file in C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA.
Reset SQL Server Forgotten SA Password
Download the SQL Server Password Changer application and install it on your computer. After launching the program, click on Open File.
When the Open dialog opens, browse to the location of the master.mdf file we find in the steps above, select master.mdf and click Open.
The program will pull the list of all SQL login accounts. Select the SA account, and click the Change Password button. Afterwards, type whatever new password you want, and click OK.
- The program will immediately reset lost SA password, as well as unlocking the SA account if it's already locked out or disabled. Now start your SQL Server service and log in to the SQL Server Management Studio with your new password. You now have system admin access to your SQL Server 2016/2014 instance.