Cannot Login to SQL Server using administrator account

After installing SQL server on a machine, it happens that you connect or disconnect that machine to domain. WHen you do this, the administrator account can no longer access the database engine. The below steps allow you to regain access to the SQL server…

1.Stop SQL Service: on the command line type: net stop MSSQLServer
2.Start the SQL Server in Management mode: on the command line type: net start MSSQLServer /m
3.Open the SQL Server management studio, cancel the login dialog
4.Open new sql server engine query window: from the menu, Click file->new->Database engine query
5.Enable SA account if not enabled: in the query window type: Alter login sa enable
6. Set the password of the sa account: alter login sa with password=’my password’
7.Stop the SQL server from the command line: net stop MSSQlServer
8.Start SQL Service from the command line: net start mssqlserver
9.Start the SQL Management studio and connect to the server using sa account
10.Add you domain administrator as sysadmin
11.Disable the sa account when you finish

原文地址:https://www.cnblogs.com/bi-info/p/6264903.html