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

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.