3

I have an application attempting to connect to SQL Server. The application connects using a SQL Server account. The password for this account was accidentally changed. Now the application is attempting to connect to SQL Server using the wrong password.

Login failed for user ''. Reason: Password did not match that for the login provided. [CLIENT: ]

Ideally, we can just change the account/password the application is using to connect. If this were not an option, is it possible to trace the password the application is attempting to use to connect?

  • As far as my knowledge goes its not possible. – Shanky Oct 16 '14 at 18:58
  • But if someone still knows the password (e.g. stored in a Password Vault of some kind) then the password could be reset on the SQL Server. – RLF Oct 16 '14 at 19:25
  • There is a method to do this on the OS side that I have not heard Microsoft ever closed but I would not consider it an option. – Shawn Melton Oct 16 '14 at 19:35
  • This is why you should store passwords in a secure location that you can refer to later. – Max Vernon Oct 16 '14 at 20:29
8

The short answer is you can't see the password being used to connect. That being said, you can restore a backup copy of the master database to a test instance, get the hashed password, and then apply it with the HASHED option of ALTER LOGIN.

The password hash can be retrieved from the restored master database with:

SELECT LOGINPROPERTY('your-sql-login', 'PasswordHash');

The password can then be applied to the other instance, substituting the value from the script above:

ALTER LOGIN your-sql-login
WITH PASSWORD = 0x01000CF35567C60BFB41EBDE4CF700A985A13D773D6B45B90900 HASHED;
  • 2
    +1 nice one Dan, however it relies on a valid backup existing from before the change. An easier fix, of course, would just be to change the password and change the app (and then (1) write that down somewhere and (2) stop giving everyone in the company the ability to change any account's password). – Aaron Bertrand Oct 16 '14 at 21:03
  • I would also expect that the app owner has the original password, and could give it to Kyle to set. That would be easier than restoring master. – Dan Guzman Oct 17 '14 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.