Solved: How to Reset SA Password in MS SQL Server
How to reset the SA password on SQL Server express if you forgot the SA password?
System Admin (SA) is one Microsoft SQL server account created in default when you install the instances of SQL server and database on your computer. SA account is viewed as the administrator account of the SQL Server. Normally, in order to administer any infrastructure of the SQL server, we're supposed to download and install Microsoft SQL Server Management Studio (SSMS), which is also the basic to reset the SA password in many cases.
- 3 Ways to reset SA password on SQL Server:
- Way-1: Reset SQL Server SA password by SQL Password Tuner
- Way-2: Reset SQL Server SA password by Command Prompt
- Way-3: Reset SQL Server SA password by single-user mode
Way-1: Reset SA password by SQL Password Tuner
Cocosenor SQL Password Tuner is a very good helper to reset the SA password in the MS SQL server and it supports MS SQL Server Express 2014/2012 and earlier versions. If you forgot the SA password and cannot access any other login account either, you can try this SQL Password Tuner to reset your SA login password or other account passwords.
1. Download SQL Password Tuner and install it on your PC.
2. Launch the software and click the Open File button from the software interface.
3. Navigate to the path of the SQL data files. And then select the SQL server database file (Master.mdf file), which is a default data file for saving the information of the SA account.
4. Select the SA account from the list of the user name. Then click the Reset button to change the SA password.
If error prompts, you may need to check and stop the service of the SQL server. The SQL server can be stopped by CMD or in Service. As the following picture shows, select the SQL Server (MSSQLSERVER) in Service windows and click Stop.
Way-2: Reset SA password by Command Prompt
If you don't want to use other 3rd-party tools to reset the SA password, you can run the Command Prompt to execute commands to reset the SA password. It will be effctive on most of the time.
1. Head to Start bar and search for the Command prompt. And then right click to run as administrator.
2. Execute the command: osql -L. And press the enter key.
3. Execute the command: OSQL -S server -E. Replace the server with your current server's name.
4. Execute the command: EXEC sp_password NULL, 'password', 'sa'. Replace the password with a new password you want to reset for the SA account.
Way-3: Reset SA password by Single-User Mode
Single-user mode can limit connections to the instance of SQL Server and makes one account that connects to the SQL Server as the sysadmin role in case of all the other logins disabled or something else. We're going to create a new sysadmin in single-user mode to access the SQL Server and reset the SA password. By the way, if you have other accessible login accounts, resetting the SA password will be easier, referring to Part-2.
Part-1: create a new system admin account in single-user mode
Step-1. Head to Start bar and search for the Command prompt. And then right click to run as administrator. (You can also use SQL Server Configuration Manager to set single-user mode.)
Step-2. Execute the command: net stop MSSQLSERVER. And press Enter to the next command: net start MSSQLSERVER -m"SQLCMD". The SQL Server Service was started in single-user mode.
Step-3. Execute the command: sqlcmd, and press the Enter key.
- (1). Then execute another command: CREATE LOGIN name WITH PASSWORD='password'. Replace the name with a new login name as you like.
- (2). Type in go and press Enter key to end.
- (3). Then execute the command to set the account to the System administrator role. Command: SP_ADDSRVROLEMEMBER name,'SYSADMIN'. You need to replace the name to your new login name.
- (4). Type in go and press enter key to end. And input exit to exit the SQLCMD.
Step-4. Execute the command as below in Command Prompt to stop and restart the SQL Server Service. Then a new SQL Server system admin login account was created.
Part-2: log in to reset SA password in SQL server
Log in to the new system admin (SA) account so that you can reset the old SA password. Here' is going to reset the SQL Server express SA password.
1. Run MS SQL Server Management Studio.
2. Select SQL Server Authentication from the draw-down list in the Authentication tab.
3. And select/type in your new system admin login account and the password. Click Connect.
4. After login, expand the Security folder from the Object Explorer. And navigate to Logins >> sa. Double click on the sa or right click to select properties.
5. Under the General tab, you can reset the SA password and then confirm the password. Click OK to exit.
Related Articles
- Recover SQL Server SA or other user password with SQL Password Tuner
- Fixed: SQL Server Login Failed Error 18456 for User SA
- How to Change SQL SA Password from a Command Prompt
- How to Change/Reset MS Access Database Password
- How to Reset or Recover Outlook Data File Password
- Locked out of Windows 10 laptop forgot password how to unlock