Skip to content

May 26, 2011

16

How to recover SA password on Microsoft SQL Server 2008 R2

When you are using MS SQL Server in mixed mode, it is very important that you know your SA password.

There can be different reasons you lost the password

  • Person who installed the SQL Server knows the password but has left the building.
  • You did not write down the password in your password file
  • Password file is lost

Steps to recover the SA password

  • Start SQL Server Configuration Manager

  • Stop the SQL services

  • Edit the properties of the SQL Service

  • Change the startup parameters of the SQL service by adding a –m; in front of the existing parameters

  • Start the SQL services. These are now running in Single User Mode.
  • Start CMD on tthe SQL server
  • Start the SQLCMD command. Now you will see following screen

  • Now we create a new user. Enter following commands
    • CREATE LOGIN recovery WITH PASSWORD = ‘TopSecret 1′ (Remember SQL server has default strong password policy
    • Go
      • Now this user is created
  • Now we grant the user a SYSADMIN roles using the same SQLCMD window.
    • sp_addsrvrolemember ‘recovery’, ‘sysadmin’
    • go
  • Stop the SQL service again
  • Change the SQL service properties back to the default settings

  • Start the SQL service again and use the new created login (recovery in my example)
  • Go via the security panel to the properties and change the password of the SA account.

  • Now write down the new SA password.
Share and Enjoy:
  • LinkedIn
  • Facebook
  • del.icio.us
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
Read more from General, Security, SQL
16 Comments Post a comment
  1. bahare
    Sep 19 2011

    very Well It works!thank you for sharing your information in such a good way!!!

    Reply
  2. Craig Martin
    Feb 10 2012

    This was EXACTLY what I needed. Thanks much!

    Reply
  3. Stephen Miller
    Mar 1 2012

    Thank you thank you thank you

    Reply
  4. Sancho
    Mar 4 2012

    I also find other 3 methods to reset forgotten SA password, learn more details at: http://www.top-password.com/knowledge/change-sql-server-password.html

    Reply
  5. Mar 10 2012

    Nice job !!! Thank you !!! *****

    Reply
  6. Fredrik
    Mar 15 2012

    Super! You made my day!

    Reply
  7. Mar 28 2012

    great how to, Thanks a lot

    Reply
  8. Gaurav
    Mar 29 2012

    Thanks a lot .. it worked for me .. saved my lot of time for reinstallation

    Reply
  9. Harish
    Mar 30 2012

    Very very useful,, this resolves my issue,,,
    I was very much happy,,,,,,,

    Thanks a lot for the guys who have found this…

    Reply
  10. JRH
    Apr 5 2012

    This works (as you knew it would) Thank you.

    Reply
  11. Apr 11 2012

    Thank you the above article is very helpfull

    Reply
  12. Apr 13 2012

    This article saved a lot of time for me. Thank you

    Reply
  13. T
    Apr 14 2012

    Thanks for the step by step details, this helped a lot with the default instance. Would you know how to make it do it for a named instance? I have searched and searched by no one seems to be plagued by a named instance. So maybe I’m missing something really obvious?

    Reply
  14. Apr 21 2012

    It’s not Working properly……It’s getting Occur
    Sqlcmd: Error:Sqlserver Native Client 10.0 login Timeout Expaired…

    How to solve it…

    Reply
    • gertvangorp
      Apr 24 2012

      Hi,

      Can you send me the steps you followed and where it went wrong??

      Thanks

      Gert

      Reply
  15. Kaz
    Apr 23 2012

    Thank you – just what I was looking for and very easy to follow.

    Reply

Leave a comment

required
required

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments