Read time 4 minutes

Summary: The content discusses ways to reset the password for an SQL Server account, covering methods for both Windows Authentication-enabled and non-enabled scenarios. It includes steps for using SQL Server Management Studio and Command Prompt, along with an option to reset the password using SQL scripts.

SQL Server passwords hold great importance for administrators. In the event of forgetting your password, the login process can be time-consuming as it necessitates a password reset. This blog provides the necessary guidance to help you reset your SQL Server password.

Ways to Reset the Password of an SQL Server Account

  1. If ‘Windows Authentication’ is enabled
    To reset password using Windows Authentication, you need to have SQL Server Management Studio installed on your system. Install SSMS, if you don’t have. Once done, follow these steps to reset your SQL Server account password.

    1. Open SQL Server Management Studio and choose Windows Authentication from the Authentication dropdown menu.
    2. Click the Connect option. It will lead you to the server dashboard.
    3. Double-click your server account name folder on the left side of the window, and proceed to the Security>Logins section.
    4. Then from the expanded Logins options, right-click on sa. Then click on Properties option from the list.
    5. The System Administrator Properties window will appear, allowing you to reset the password for the SQL account using the provided options. Once you’ve entered the new password, click the OK the OK button
    6. Hence, the password is reset for your SQL Server account.

    Reset Password Using SQL Script
    You can also reset the SQL Server password using Windows Server authentication by executing SQL scripts within SQL Server Management Studio. Simply follow these instructions:

    1. First, open the SQL Server Management Studio.
    2. Then, open a new query.
    3. Execute the provided script syntax as the query to reset the password for the SQL Server account directly.
    4. GO
      USE [master]

      Please input the password you’d like to use in place of NewPassword within the script. Please note that this password will always be case-sensitive.

    5. Attempt to log in to the SQL system using these credentials. If you can successfully access the system, it indicates that the password has been reset.
    6. Note: A temporary password will be generated for accessing your SQL Server account, necessitating a subsequent password reset.

  2. If ‘Windows Authentication’ is not enabled
    If your SQL Server doesn’t already have Windows Authentication enabled and necessitates login credentials to access the SQL Server account, you can employ Command Prompt to establish a new password for the SQL Server account. Please share the steps to accomplish this.

    1. Type Command Prompt in the search box at the Start Menu of your system.
    2. To initiate the Command Prompt application with administrator privileges, begin by right-clicking on the application icon and selecting the “Run as administrator” option. Upon doing so, confirm your selection by clicking “Yes.” This will grant the Command Prompt application the necessary administrative rights.
    3. In the Command Prompt screen, type osql -L and press Enter.
    4. Next, type OSQL -S server -E and press Enter. (type your server name in place of server in the command).
    5. Now, to create a new password for the SQL Server account, type EXEC sp_password NULL, ‘password’, ’sa‘ and press Enter. (Here, type a new password you want to set for your account in place of the password in the command.
    6. Execute this final command by typing GO and then press Enter.
    7. Get exit from the Command Prompt application by typing exit and press Enter.
    8. Try to log in with the newly set password. If it works, the password is successfully set.

So, by using these solutions as per your scenario, you can reset the desired password for your SQL Server account. However, if you face multiple SQL Server errors or database corruption, try Kernel for SQL Database Recovery. This SQL recovery solution is a robust and all-encompassing tool designed to tackle a wide range of SQL problems, including the restoration of corrupted MDF files. It is compatible with SQL Server 2019 as well as earlier versions.

Kernel for SQL Database Recovery