Change SQL Server (MSSQL) Password

If you’ve forgotten the sa password for your SQL server, you are probably in a panic. Fear not, for you can change the password and once again have access to the powers of the SA account using Windows Authentication mode.

Login into SQL Server using Windows Authentication.

In Object Explorer, open Security folder, open Logins folder. Right click on SA account and go to Properties.

sql-server-management

Change SA password, and confirm it. Click OK.

change-sql-server-password

Change SQL Server Password Using SQL Script

Open the SQL Server Management Studio.
Open a New Query.

Copy, paste, and execute the following:


    GO
    ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
    GO
    USE [master]
    GO
    ALTER LOGIN [sa] WITH PASSWORD=N'NewPassword' MUST_CHANGE
    GO

where NewPassword is the password you wish to use for the sa account.

Option 3: Change SQL Server Password with Third Party Software

Download SQL Server Password Changer on your local PC, install and launch it.

Click the Open File button. Select the SQL Server master database file (master.mdf). Typically it is located in the folder: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data.

open_sqlserver

The program will automatically decrypt the master database file and display all user accounts in your SQL Server. Select the SA account, click the Change Password button. Type a new password and click OK.

sqlserver_pwd

The program will replace the existing password with your new password, and also unlock your SA account if it’s already locked out or disabled.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.