4
4
I have lost all passwords
for a SQL Server instance, how do I give myself admin access again?
4
4
I have lost all passwords
for a SQL Server instance, how do I give myself admin access again?
1
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.
8
Open Configuration Manager
Stop the server instance
Right, click >> properties >> advanced >> startup parameters
Add "-m;" right at the start of the string ensuring there are no spaces anywhere in the string
Restart server
sqlcmd -S localhost
from the
command prompt
EXEC sp_addsrvrolemember
'domain\username', 'sysadmin'; GO
exit
Ensure can connect from command
prompt sqlcmd -S localhost -E
(if logged-in as that user to windows)
Remove "-m;" from startup parameters
Restart the database server
2
And with screenshots! http://blogs.ameriteach.com/chris-randall/2009/12/11/sql-server-2008-forgot-to-add-an-administrator-account.html
– ta.speot.is – 2010-03-22T02:25:12.857For some reason this didn't work for me: step 9 was unable to connect. But note that at step 6 you can instead run SSMS locally and create the login that way. That worked for me. – RomanSt – 2015-11-20T07:44:59.113