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

前端 未结 19 2779
闹比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:20

    In .net Core also you may get this error if Trusted_Connection=True; Is set. Sample setting in appsettings.jason

    ConnectionStrings": {
    "DefaultConnection": "Server=serverName; Database=DbName; uid=userId; pwd=password; MultipleActiveResultSets=true"
    

    },

    0 讨论(0)
  • Why not use a SQL Server account and pass both the user name and password?

    Here is the reason why.

    In short, it looks like you have an authentication issue.

    The problem with workgroups is there is no common Access Control List like Active Directory (AD). If you are using ODBC or JDBC, the wrong credentials are passed.

    Even if you create a local windows account (LWA) on the machine (SE) that has SQL Express installed (SE\LWA), the credentials that will be passed from your client machine (CM) will be CM\LWA.

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

    In my case the Aliases within SQL Native Client 11.0 Configuration were pointing to invalid server/IP. Once updated it worked correctly.

    To check: 1. Start "SQL Server Configuration Manager" 2. Navigate to "SQL Native Client 11.0 Configuration" and then "Aliases" 3. Ensure "Alias Name" and "Server" match correctly for TCP/IP

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

    I had this problem because we where using a DNS name from an old server, ponting to a new server. Using the newserver\inst1 address, worked. both newserver\inst1 and oldserver\inst1 pointed to the same IP.

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

    I was facing the issue while connecting to SQL Always On Listener. Disabling the loop back check resolved the issue.

    1. Edit the registry using regedit. (Start –> Run > Regedit )

    2. Navigate to: HKLM\System\CurrentControlSet\Control\LSA

    3. Add a DWORD value called “DisableLoopbackCheck”

    4. Set this value to 1

    https://blog.sqlauthority.com/2017/04/18/sql-server-login-failed-login-untrusted-domain-cannot-used-windows-authentication/

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

    Just adding my suggestion for a resolution, I had a copy of a VM server for developing and testing, I created the database on that with 'sa' having ownership on the db.

    I then restored the database onto the live VM server but I was getting the same error mentioned even though the data was still returning correctly. I looked up the 'sa' user mappings and could see it wasn't mapped to the database when I tried to apply the mapping I got a another error "Fix: Cannot use the special principal ‘sa’. Microsoft SQL Server, Error: 15405". so I ran this instead

    ALTER AUTHORIZATION ON DATABASE::dbname TO sa

    I rechecked the user mappings and it was now assigned to my db and it fixed a lot of access issues for me.

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