Trouble Connecting to sql server Login failed. “The login is from an untrusted domain and cannot be used with Windows authentication”

前端 未结 19 2777
闹比i
闹比i 2020-12-05 12:38

I am trying to host a SQL server database, but whenever I try to connect to it I get this error:

The login is from an untrusted domain and cannot be u

相关标签:
19条回答
  • 2020-12-05 13:08

    We now use a privileged account management solution that changes our passwords regularly. I ended up receiving this error after my password was changed. Closing and re-opening SSMS with the new password resolved my issue.

    0 讨论(0)
  • 2020-12-05 13:09

    In order to use Windows Authentication one of two things needs to be true:

    1. You are executing from the same machine as the database server.
    2. You have an Active Directory environment and the user the application is executing under (usually the logged in user) has rights to connect to that database.

    If neither of those are true you have to do one of two things:

    1. Establish a Windows Domain Controller, connect all of the relevant machines to that controller, then fix SQL server to use domain accounts; OR,
    2. Change SQL server to use both Windows and SQL Server accounts.

    By FAR the easiest way is to change SQL Server to use both Windows and SQL server accounts. Then you just need to create a sql server user on the DB server and change your connection string to do that.

    Best case option 1 will take a full day of installation and configuration. Option 2 ought to take about 5 minutes.

    0 讨论(0)
  • 2020-12-05 13:09

    I've had this same issue when using DNS aliases and hosts files to connect to a machine using a different domain name.

    Say you have a SQL server called sql1 on mydomain.com - which is an Active Directory domain - and you also have a DNS zone for mydomain.net, and - for consistency - you set up a DNS alias (CNAME) record for database.mydomain.net --> sql1.mydomain.com

    You'll be able to connect to sql1.mydomain.com using Windows integrated security, but won't be able to connect to database.mydomain.net even though it's the same server because the domain name doesn't match your AD domain.

    0 讨论(0)
  • 2020-12-05 13:12

    This error message can also occur if the account you are using to access the SQL server is locked out by the domain.

    0 讨论(0)
  • 2020-12-05 13:12

    I started to get this error when i tried to login to SSMS using 'windows Authentication'. This started to happen after i renamed the Windows SQL server. I tried everything to resolve this error and in my particular case changing the machine names in the 'hosts' file to reflect the name SQL server name change resolved the issue. C:\Windows\System32\Drivers\etc\hosts

    0 讨论(0)
  • 2020-12-05 13:15

    Getting rid of Integrated Security=true worked for me.

    0 讨论(0)
提交回复
热议问题