How to reset Sql server password?

How to reset Sql server password?

For resetting sql server password there are several ways depending on the access you have.Below are the diffrent method to reset the password.

1: Open command prompt in administrator mode:

1.1:If you have forgotten the SQL Server password, you can reset it using the command prompt by following these steps:

  • Open Command Prompt.
  • Connect to your SQL Server instance using the sqlcmd utility

1.2:Goto Sql services and right click and go to property then copy server instance(-sMSSQLSERVER) name then execute below command in cmd as Adminstrator mode:

  • sqlcmd -sMSSQLSERVER
  • ALTER LOGIN [sa] WITH PASSWORD = ‘NewPassword’;
  • go
  • exit

1.3:It’s an another way for you to use SQLCMD utility to modify password if you remember the old sa password but want to reset new password but in more simplest way you can use SSMS to reset the password . Follow the steps below, executing SQLCMD commands in command prompt to set a new password.

  1. Run up the Command Prompt as Adminstrator mode.
  2. type command :sqlcmd -U someuser -P currentpassword -z newpassword.
  3. go
  4. exit

2.Reset the password using SQL Server Management Studio(SSMS).

  • Open SQL Server Management Studio (SSMS).
  • Connect to the SQL Server instance.
  • Expand the Security folder.
  • Expand the Logins folder.
  • Right-click on the login for which you want to reset the password and select Properties.
  • In the Login Properties window, enter the new password in the Password and Confirm password fields.
  • Click OK.
  • Using T-SQL
  • If you have access to the SQL Server and can execute T-SQL commands
  • Connect to the SQL Server instance.
  • Execute the following T-SQL command:
  • ALTER LOGIN [YourLoginName] WITH PASSWORD = ‘NewPassword’;
  • Replace YourLoginName with the login name and NewPassword with the new password you want to set.

Summary:Resetting a SQL Server password can be done using SSMS, T-SQL, command-line tools, or by sqlcmd utility. The appropriate method depends on the access and permissions you have. If you have administrative privileges, using SSMS or T-SQL is straightforward. If you are completely locked out,then you can use sqlcmd utility.