4

I am using SQL Servre 2008 R2. I recently changed my domain name and after that when I try to login to SSMS using Windows authentication, I get an error

Login Failed For User UserName
Microsoft Sql Server Error : 18456.

How to resolve it? Can somebody please help to get login in SSMS using Windows authentication mode again?

Thanks in advance

marc_s
9,0626 gold badges46 silver badges52 bronze badges
asked Jan 28, 2013 at 8:35
1
  • What to do if SQL Mode is disable or don't know sa password Commented Jul 18, 2013 at 8:41

1 Answer 1

5

You should login with SQL authentication (with your sa account) and run this query:

DROP LOGIN [OldDomain\UserName]
GO
CREATE LOGIN [NewDomain\UserName] FROM WINDOWS WITH DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english]
GO
ALTER SERVER ROLE [sysadmin] ADD MEMBER [NewDomain\UserName]
GO

You will then be able to login with your new domain name (be sure you change the domain name and username in the code).

If you need to recover your sa password you can read this article http://v-consult.be/2011/05/26/recover-sa-password-microsoft-sql-server-2008-r2/

answered Jan 28, 2013 at 9:06
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.