Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have lost all passwords for a SQL Server instance, how do I give myself admin access again?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Run SSMS as Administrator (ie, with escalated privileges on the server). This should have sysadmin rights, and you can then find your login and assign rights as necessary.

Almost wrote "tights" there. You can probably assign them too, if you're running as an admin on the server.

share|improve this answer
  1. Open Configuration Manager

  2. Stop the server instance

  3. Right, click >> properties >> advanced >> startup parameters

  4. Add "-m;" right at the start of the string ensuring there are no spaces anywhere in the string

  5. Restart server

  6. sqlcmd -S localhost from the command prompt

  7. EXEC sp_addsrvrolemember 'domain\username', 'sysadmin'; GO

  8. exit

  9. Ensure can connect from command prompt sqlcmd -S localhost -E (if logged-in as that user to windows)

  10. Remove "-m;" from startup parameters

  11. Restart the database server

share|improve this answer
1  
And with screenshots! blogs.ameriteach.com/chris-randall/2009/12/11/… –  ta.speot.is Mar 22 '10 at 2:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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