Table of Contents
This updated guide examines How to Reset Sa Password in SQL Server and organizes the essential facts, background, and practical takeaways in clear American English.
Responsible-use note: Apply security techniques only to systems you own or are explicitly authorized to test.
Method 1
Using Windows Authentication
Understand how this method works. If Windows Authentication is enabled for your server, you can use it to log into your server without having to enter a password. After you're logged in, you can easily change the SQL server's password.[1]XResearch source
- If Windows Authentication isn't enabled, you'll need to either use Single-User Mode or use Command Prompt to reset your password.
Make sure that SSMS is installed. SSMS is a user interface which allows you to change different aspects of your SQL Server settings in a window rather than in Command Prompt. If you don't have SSMS installed, do the following:
- Go to the SSMS installation page in a browser.
- Click the Download SQL Server Management Studio 17.6 link.
- Double-click the downloaded SSMS setup file.
- Follow the on-screen prompts to install SSMS.
Open SSMS. Typesql server management studiointo Start, then click Microsoft SQL Server Management Studio 17 at the top of the Start window.
Select the correct authentication. Click the "Authentication" drop-down box, then click Windows Authentication in the menu.
ClickConnect. It's at the bottom of the window. If Windows Authentication is allowed for your account, doing so will log you into your server's dashboard.
Expand your server's folder. If your server's folder in the upper-left side of the window doesn't have several options below it, click the ? icon to the left of it to expand it.
Expand the "Security" folder. It's below the server's name.
Expand the "Logins" folder. You'll find this in the group of options below the "Security" folder.
Double-clicksa. It's in the "Logins" group of options. Doing so opens your System Administrator properties window.
Enter a new password. Type your new password into both the "Password" and the "Confirm password" text fields near the top of the window.
ClickOK. It's at the bottom of the window. Doing so will change your password and close the properties window.
Method 2
Using Single-User Mode
Understand how this method works. Even if you've locked out your only account, you can add a user and give them administrator permissions by using the Command Prompt. After doing this, you can use the new user's credentials to log into your SQL Server page, from which point you can change the SA password.[2]XResearch source
Make sure that SSMS is installed. SSMS is a user interface which allows you to change different aspects of your SQL Server settings in a window rather than in Command Prompt. If you don't have SSMS installed, do the following:
- Go to the SSMS installation page in a browser.
- Click the Download SQL Server Management Studio 17.6 link.
- Double-click the downloaded SSMS setup file.
- Follow the on-screen prompts to install SSMS.
Open Command Prompt in administrator mode. Open Start
, then do the following:
- Type incommand prompt
- Right-click
Command Prompt - Click Run as administrator
- Click Yes when prompted.
Stop SQL Instance from running. Type innet stop MSSQLSERVERand press?Enter. This will stop the currently running SQL services.
Restart SQL in Single-User Mode. Type innet start MSSQLSERVER -m"SQLCMD"and press?Enter.
- You won't see any indication that you're running in Single-User Mode at this point, but you should see the phrase "The SQL Server service was started successfully" appear.
Connect to SQL. Type insqlcmdand press?Enter. Doing so opens the SQL command line.
Create a new user and password. You'll do this with typed commands in the SQL command line:
- Type inCREATE LOGIN name WITH PASSWORD='password'where "name" is the account name and "password" is the new password.
- Press?Enter.
- Type inGOand press?Enter.
Add the user to the System Administrator role. Type inSP_ADDSRVROLEMEMBER name,'SYSADMIN'where "name" is the account name, press?Enter, and then type inGOand press?Enter.
Exit the SQLCMD command line. Type inexitand press?Enter.
Restart SQL in regular mode. You can cancel Single-User Mode by typing innet stop MSSQLSERVER && net start MSSQLSERVERand pressing?Enter.
- You should see the "The SQL Server service was started successfully" phrase appear again; at this point, you can close Command Prompt.
Open SSMS. Typesql server management studiointo Start, then click Microsoft SQL Server Management Studio 17 at the top of the Start window.
Select the correct authentication. Click the "Authentication" drop-down box, then click SQL Server Authentication in the menu.
Log in with the new user's credentials. Click the "Login" drop-down box, then click the name of the user you just created.
Enter the password. Type the user's password into the "Password" text box near the bottom of the window.
ClickConnect. It's at the bottom of the window. As long as you adequately entered your username and password, this will open your server's dashboard.
Expand your server's folder. If your server's folder in the upper-left side of the window doesn't have several options below it, click the ? icon to the left of it to expand it.
Expand the "Security" folder. It's below the server's name.
Expand the "Logins" folder. You'll find this in the group of options below the "Security" folder.
Double-clicksa. It's in the "Logins" group of options. Doing so opens your System Administrator properties window.
Enter a new password. Type your new password into both the "Password" and the "Confirm password" text fields near the top of the window.
ClickOK. It's at the bottom of the window. Doing so will change your password and close the properties window.
Method 3
Using Command Prompt
Open Start
. Click the Windows logo in the bottom-left corner of the screen. This will open the Start menu.
Search for Command Prompt. Type incommand prompt, then wait for Command Prompt to appear at the top of the Start menu.
Right-click
Command Prompt. Doing so will prompt a drop-down menu.
ClickRun as administrator. It's in the drop-down menu.
ClickYeswhen prompted. This will confirm your decision to open Command Prompt in administrator mode. The Command Prompt window should open.
Enter the first command. Type inosql -Land press?Enter.[3]XResearch source
Enter the second command with your server's name. Type inOSQL -S server -Ewhere "server" is replaced by your server's name, then press?Enter.
Create a new password. Type inEXEC sp_password NULL, 'password', 'sa'where "password" is replaced by the password that you want to use, then press?Enter.
- For example, to set your password as "rutabaga123", you would typeEXEC sp_password NULL, 'rutabaga123', 'sa'into Command Prompt.
Execute the command. Type inGO, then press?Enter. Typeexit, then press?Enterto exit OSQL.
Attempt to log into SQL Server. Do so by using your administrator credentials and your new password. If you're able to log into SQL Server, your password was successfully changed.
FAQ
What is How to Reset Sa Password in SQL Server about?
It provides a structured overview of password, explains the main context, and highlights practical takeaways for readers.
Why does this topic matter?
Understanding the main concepts helps readers evaluate the issue, avoid common mistakes, and make better-informed decisions.
How should readers use this information?
Use the guidance as a practical starting point, confirm details that may have changed, and follow current product, safety, or security recommendations.
Reader Comments 0
Sign in with email or Google to join the discussion.