Posts Tagged ‘sql server 2022 password recovery’

How to Reset Lost SA Password for SQL Server 2022

May 15th, 2023 by Admin

Cannot authenticate using the sa account credential? The default sa password does not work? If you cannot establish a connection using SQL Server Management Studio or restore the master.mdf database, doing a password reset should be the fastest way to regain access to your SQL Server instance. In this tutorial we’ll walk you through the steps of resetting lost sa password for SQL Server 2022.

Part 1: Stop SQL Server Service

To get started, we need to stop the SQL Server service and find where the master.mdf database is located using File Explorer. Follow these steps:

  1. Click the Start button. When the Start menu appears, expand the “Microsoft SQL Server 2022” folder and click “SQL Server 2022 Configuration Manager“.

  2. In the left-hand side of the window, click the “SQL Server Services” entry. In the right pane, right-click “SQL Server (MSSQLServer)” or a named instance, and then choose Stop.

  3. Next, double-click the “SQL Server (MSSQLServer)” service to open the Properties dialog. Go to the “Startup Parameters” tab, and you’ll see the full path of the master.mdf file which is displayed in the “Existing parameters” list box.

    For SQL Server 2022, the default location is C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA.

  4. Open File Explorer and browse to the above location, and check if the master.mdf file can be found.

Part 2: Reset Lost SA Password for SQL Server 2022

  1. After opening the SQL Server Password Changer utility, click the Open File button in the right side.

  2. Choose the master.mdf file for your SQL Server 2022 instance, and then click Open.

  3. You’ll get the list of all database users. Simply choose the sa account and click the “Change Password” button.

  4. Enter a new sa password and click OK. Close the SQL Server Password Changer utility.

Part 3: Connect to SQL Server 2022 with New SA Password

Open the SQL Server 2022 Configuration Manager and start the SQL Server service, then launch the SQL Server Management Studio, you can then log in to the sa account with your new password!

If you get the error message “Login Failed for User (Microsoft SQL Server, Error: 18456)“, it’s possible that the authentication method of the SQL server is not properly configured. You need to use the second method descried in this article to enable mixed mode authentication.

That’s it!