简体   繁体   中英

Error: Login failed. The login is from an untrusted domain and cannot be usedwith Windows authentication

I am working over LAN using sql server inside visual studio 2013. My server has an ip address of 192.168.0.19 and my client is 192.168.0.18 my port is 49170 which i configured at windows firewall. I connect the client into the ip address of the server but i always end up on getting the Error: Login failed. The login is from an untrusted domain and cannot be usedwith Windows authentication. I use windows authentication because i haven't set a username and a password through my installation. I think im getting the error because i must use the Sql Server Authentication. But how? I dont know what to enter on username and password. Please help. Thanks!

I had this problem today, and it was caused by my Active Directory account being locked out.

Yeah... perhaps the error message should've made that a little clearer !

To check if this is the cause for you, simply open a Command Prompt and run:

net user YourUsername /domain

For example: " net user jsmith /domain ".

If your account is locked, it'll report this in the results.

I had the same issue recently. My account was not locked out, but my password had expired whilst I had an RDP session open (this session stayed open for days). Thus I could access the local SQL (on the RDP box) but when I tried to connect to a remote server in SSMS, I got the same error.

When I tried to RDP into the remote server, I then got a usable error message to the tune of... 'Your password has expired; change it or contact an admin'.

I change the password in my open RDP session; thereafter, I could login directly to the remote server, and could access it via SSMS in my open session.

Note: If I'd run the NET USER command as Mike suggests, I would have been able to see that the password expired the previous day:

净用户您的用户名/域

To solve this you can disable the loopback check by adding a registry entry as follows:

  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

If above doesn't solve the issue, we need to create SPNs for SQL Service account. While searching for SETSPN.exe command I came across this nice tool which can help a lot of pain like syntax error etc. is called as “Microsoft® Kerberos Configuration Manager for SQL Server®” which can be downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=39046

The best piece about this tool is that it can help in finding missing SPN and provide script to run or fix it directly, if you have permission. Basically, it can

Gather information on OS and Microsoft SQL Server instances installed on a server.
Report on all SPN and delegation configurations on the server.
Identify potential problems in SPNs and delegations.
Fix potential SPN problems.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM