0

I installed an instance of sql server on my machine a while back. I generally login via SSMS. I currently forgot the username and password for the instance. Is there a way I can recover it. I searched online including a pervious stack overflow post but didnt find it helpful. Is there anything I can do to recover my username and password ?

CodeNinja
  • 3,188
  • 19
  • 69
  • 112
  • possible duplicate of [How can I reset username and password for SQL Server 2008](http://stackoverflow.com/questions/1087033/how-can-i-reset-username-and-password-for-sql-server-2008) – dcaswell Oct 17 '13 at 18:09

1 Answers1

1

Did you try to Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out

Start the instance of SQL Server in single-user mode by using either the -m or -f options. Any member of the computer's local Administrators group can then connect to the instance of SQL Server as a member of the sysadmin fixed server role.

And then try to do the following steps as explained by Remus Rusanu in this answer.

  • shutdown MSSQL$EXPRESS service (or whatever the name of your SQL Express service is)
  • start add the -m and -f startup parameters (or you can start sqlservr.exe -c -sEXPRESS -m -f from console)
  • connect to DAC: sqlcmd -E -A -S .\EXPRESS or from SSMS use admin:.\EXPRESS
  • run create login [machinename\username] from windows to create your Windows login in SQL
  • run sp_addsrvrolemember 'machinename\username', 'sysadmin'; to make urself sysadmin member
  • restart service w/o the -m -f
Community
  • 1
  • 1
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331