Lost or forgot your SQL Server 2012 password? How to connect to SQL Server if SA account is locked out or disabled?
This is a common problem which is frequently asked in many sites. Many people forget their password shortly after installing Microsoft SQL Server or they have not used SQL Server after a long time. In this tutorial we’ll show you how to reset lost SA password using Windows Authentication mode or third party software.
Method 1: Reset Lost SA Password Using Windows Authentication
- Open SQL Server Management Studio, and select the authentication mode: Windows Authentication.
- Now click on the Connect button and you will be taken to the SQL Server Management Studio.
- In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties.
- On the General page, you can create and confirm a new password for the login. If your SA account is locked out or disabled, switch to the Status page. Set “Login” to “Enabled” and uncheck “Login is locked out”. Click OK.
Method 2: Reset Lost SA Password with Software
If you’re unable to login with Windows Authentication and lost sysadmin privileges to your database, then it’s a good idea to try the third-party software – SQL Server Password Changer. The program enables you to unlock / reset forgotten SA password on all SQL editions, including SQL Server 2012.
SQL Server logins are stored in the master database (master.mdf). In SQL Server 2012, you can find the master.mdf file in the directory of
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA. Before resetting SA password, you need to stop your SQL Server instance if it’s running.
Download and install SQL Server Password Changer on your server. Start the program and click on the “Open File” button. In the pop-up dialog, select the master.mdf file for your SQL Server instance and click Open. The program will extract all your SQL Server user accounts from the master.mdf file.
Choose the SA account and click on “Change Password” button. In the Change Password dialog, enter a new password for your SA account and click OK. The program will update the password hashes for your login, and unlock SA account when it is locked out or disabled.
Now start your SQL Server instance and you can then log into SA account using your specified new password. That’s it!