Changing sa password

Posted on

Question :

I’m trying to change the password of the sa account using SQL Server Management Studio 2012. I’ve followed the steps below but the password is still the same.

  1. Login into the SQL Server Management Studio, Select Database Engine, SBSmonitoring, Windows Authentication.
  2. Go to Object Explorer–Security folder–Logins folder.
  3. Right click on SA account and select the Properties option.
  4. In General Page, change the SA password and confirm it.
  5. In Status Page, change Login to Enabled. Click OK to save the change.
  6. Restart the SQL Server and all its services.

Any idea ?

Answer :

use this query it will change sa password

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

You were really near with your solution. You just have to restart the SQL Server instance SBSMonitoring after changing the sa password as explained in the following article and ensure that Mixed Mode Authentication is turned on.

Solution

Reference: What is the default password for ‘sa’ account in windows sbs 2011 standard (I have modified the orginal listing slightly):

  1. Login into the SQL Server Management Studio

    • Select Database Engine, <SBSservername>SBSmonitoring
    • open Server Properties
    • click on the Security section
    • select SQL Server and Windows Authentication mode
    • Click on OK
    • Restart SQL Server instance
  2. Go to Object Explorer–Security folder–Logins folder.

  3. Right click on SA account and select the Properties option.

  4. In General Page, change the SA password and confirm it.

  5. In Status Page, change Login to Enabled. Click OK to save the change.

  6. Restart the SQL Server and all its services.

This should do the job.

Alternative solution

Run the following statement to set the SQL Server instance to Mixed mode:

USE [master]
GO
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'SoftwareMicrosoftMSSQLServerMSSQLServer', N'LoginMode', REG_DWORD, 2
GO

Then restart your server and change the sa password as you normally would.

Mixed Mode (SQL Server and Windows Authentication mode)

If you don’t turn on Mixed Mode authentication you will constantly receive an error message when trying to log in with the sa SQL Server login even though you have changed the password and enabled the login.

Login error Windows Authentication mode

Enabling Mixed Mode (aka, SQL Server and Windows Authentication mode) will get rid of this error message.

There are various methods to do this:

1) You can do this with help of of command prompt

2) Using a third party software like SQL server password changer.link here

3) Try to restore the Master database from database backup. This won’t help in the long run because you’ll still encounter the same issue if you don’t remember the SA password.

Please refer to the below link for using command prompt which has worked for me in past:

https://technet.microsoft.com/en-us/magazine/jj853293.aspx

I want to add to John K. N. excellent answer the link for changing the authentication mode

Here it shows you

1)the steps to change from only Windows authentication to Mixed mode authentication (which will enable you to use the server authentication and change the password)

Change authentication mode with SSMS

In SQL Server Management Studio Object Explorer, right-click the server, and then
click Properties.

On the Security page, under Server authentication, select the new
server authentication mode
, and then click OK.

In the SQL Server Management Studio dialog box, click OK to
acknowledge the requirement to restart SQL Server.

In Object Explorer, right-click your server, and then click Restart.
If SQL Server Agent is running, it must also be restarted.

2)how to change the password

Using Transact-SQL

The following example enables the sa login and sets a new password. Replace
[enterStrongPasswordHere]
with a strong
password before you run it.

ALTER LOGIN sa ENABLE ;  
GO  
ALTER LOGIN sa WITH PASSWORD = '[enterStrongPasswordHere]' ;  
GO

It just worked for me

My understanding is that you should always change the password through the SQL Server Configuration Manager. Otherwise it may not correctly change throughout the system.

if you are using “windows authentication” only, then your SA account is disabled by default. Verify that you are using mixed authentication, otherwise you won’t be able to log in to sql server.

Leave a Reply

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