Wednesday, October 30, 2013

SQL Server 2008 database engine login "sa" failed for administrator user

Depending on what mode SQL Server was installed (Windows Authentication or Mixed Mode), you may have to do a few things. If you installed in mixed mode, you can log in as sa and add the administrator user as a Login under the Security section. Make sure you assign sysadmin role to the user, which can be found under Server Roles.

If Windows Authentication mode was chosen during install then there are a couple of things you can do, but I think the easiest is just to recreate the user "sa_new", login into SQL Server as that user, and follow the previous step to add the administrator user as a login.

UPDATE: If all else fails, you can run SQL Server in Single User Mode, which allows a single connection to the server, and enable/change the sa password. To do this you can:
  1. Open the command prompt (Right-Click on and select "Run As Administrator")
  2. From the command prompt type net stop MSSQLSERVER
  3. Next type net start MSSQLSERVER /m
  4. Open SQL Server Management Studio. Do not login, cancel the login dialog.
  5. From the file Menu select New->Database engine query, and login (Make sure you use the host name and not localhost).
  6. Execute the query ALTER LOGIN sa WITH PASSWORD = ''; to reset the password (if the sa is not enabled then type ALTER LOGIN sa ENABLE to do so)
  7. Login with the sa user and add the Administrator user.
EDIT:
For step 6 you may have to do ALTER LOGIN sa WITH PASSWORD = '' UNLOCK;, because the sa account may be locked from too many login attempts.

Tested on Windows 7 Ultimate with SQL Server 2008 Standard. Hope this helps.

No comments:

Post a Comment