Reset SA Password in SQL Server

SQL Server

Sometimes you just need to reset the SA account password in SQL Server. You can easily reset the password in SQL Server Management Studio , but you can also use a Transact_SQL script or command prompt.

Using SQL Script

Step 1: Open the SQL Server Management Studio.

Step 2: Then, open a New Query and copy, paste, and execute the following:

GO
ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
GO
USE [master]
GO
ALTER LOGIN [sa] WITH PASSWORD=N’Password’ MUST_CHANGE
GO

Note: The Password is the new password you would like to use with the SA account.

 

Using command prompt

Step 1: Go to the command prompt of the server and osql –L.

Step 2: Copy full name of SQL Server and type: OSQL -S [servername] -E.

Step 3: Execute the following query: sp_password NULL, ‘[new_password]’, ’sa’.

Step 4: Then, GO.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s