Question
How to reset a password for the sa user of a Microsoft SQL Server instance?
Answer
To change a password for the sa user use any of these tools:
- Plesk interface (if Microsoft SQL Server instance is registered in Plesk)
- osql utility in a command prompt
- Microsoft SQL Management Studio
Follow these steps if Microsoft SQL Server instance is registered in Plesk.
-
Go to Tools & Settings > Database Servers.
-
Click on a hostname of a Microsoft SQL Server instance, password for which you wish to change.
-
Click Change Password.
-
Specify a new password and click OK.
-
Connect to a server via RDP.
-
Start a command prompt as an Administrator and list all Microsoft SQL Server instances:
C:> OSQL -L
Servers:
WIN-TVSNFL1C14UMSSQLSERVER2016
WIN-TVSNFL1C14UMSSQLSERVER2017Note: As stated by Microsoft, due to the nature of broadcasting on networks, osql may not receive a timely response from all servers. Therefore, the list of servers returned may vary for each invocation of this option. If the command does not display any server, try to execute it another time.
-
In the command below, specify a Microsoft SQL Server instance for which you want to reset a password and replace ***** with your new password. Once done, run the command:
C:> osql -S "WIN-TVSNFL1C14UMSSQLSERVER2017" -E -Q "exec sp_password NULL,'*****','sa'"
-
For a remote Microsoft SQL Server instance, use its remote server name or IP address:
C:> osql -S "SERVERNAME or IP ADDRESSINSTANCE_NAME" -E -Q "exec sp_password NULL,'*****','sa'"
-
-
Connect to a server via RDP.
-
Download and install SQL Server Management Studio on your Windows Server.
-
Once installed, start Microsoft SQL Management Studio. To do this, run the command below in a command prompt:
C:> ssms.exe
-
Select Microsoft SQL Server instance for which you want to reset a password from the drop-down list and connect using Windows Authentication.
-
In the Object Explorer, expand Security > Logins > right-click on sa to open its Properties.
-
In the Properties window, set a new password for sa and click OK to apply the changes.
If Windows administrator does not have permissions to reset a sa user password, refer to the instructions from this Microsoft article: