Couldn’t get into a 2008 SQL server today, whoops!
No one had the credentials so I had to get myself access. I found an article covering adding yourself via single user mode, but thought I’d add some more details for my own information and to cover missing info on that page.
Shut down any services related to SQL and anything that connects to it. The ones I shut down on the server side were:
- SQL Server VSS Writer
- SQL Server (MSSQLSERVER)
Next step, start SQL in sngle user mode C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn\sqlservr.exe -m
Eventually it’ll show that SQL server is running
Start up another command prompt in Administrator mode, then run the following commands. Replace SERVERNAME with the local hostname, and username with your admin account username. sqlcmd -E CREATE LOGIN [SERVERNAME\username] FROM WINDOWS go exec sp_addsrvrolemember @loginname=‘SERVERNAME\username’, @rolename=‘sysadmin’ go
Type “exit” and hit enter to close out of that SQL command line agent, then Ctrl-C in the SQL server window to shut it down.
Start the server back up using services.msc.