To reset the password of a SQL Server, you can follow these steps depending on the authentication mode and your access level:
Using SQL Server Management Studio (SSMS):
sa account).Using T-SQL:
Run the following command in a new query window:
ALTER LOGIN [username] WITH PASSWORD = 'new_password';
Replace [username] with the login name and 'new_password' with the new password.
sa password):Using Single-User Mode:
-m parameter to the startup options. For example:
net stop MSSQLSERVER
net start MSSQLSERVER /m
sqlcmd with a Windows account that has local administrator privileges.sa password using T-SQL:ALTER LOGIN sa WITH PASSWORD = 'new_password';
Using Dedicated Administrator Connection (DAC):
If the server is running but inaccessible, you can use DAC to reset the password. This requires enabling DAC first (if not already enabled) and connecting with a high-privilege account.
If you’re using SSMS and want to reset the password for a user named app_user, follow these steps:
app_user, and select Properties.For cloud-hosted instances, use the provider’s console (e.g., Tencent Cloud’s SQL Server Managed Service) to reset passwords securely.