If you in case forget add any account to sql server, or forget all the account to login to the sql server. what should I do? Reinstall the SQL Server instance? Here is an simpler solution from others which is really good.
Step 1. Stop all the SQL server instance and related services
Step 2. Run sqlservr -m from command. This command will start the sql server in single-user mode. sqlservr normally stored in Binn folder in SQL Server.
Step 3. Open a new command, Run SQLCMD -S -E ,type the commands next:
CREATE LOGIN [\] FROM WINDOWS
EXEC sp_addsrvrolemember @loginame=’\’, @rolename=’sysadmin’
Last Step: Restart the Sql Server instance. the command is NET Start MSSQLSERVER