Published on

August 22, 2012

Fixing SQL Server Login Error

Have you ever encountered an error message when trying to connect to your local SQL Server using the IP address 127.0.0.1? The error message might have said something like “Cannot connect to 127.0.0.1. Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.”

If you have experienced this issue, you’re not alone. Many users have faced the same confusing error, especially when trying to connect from a local machine to a local SQL Server. The error message seems to suggest that the login is from an untrusted domain, even though the system is not part of any domain.

So, what could be causing this error? The solution might be simpler than you think. One possible reason for this error is a modification made to the computer’s host file. The host file is a text file that maps hostnames to IP addresses. It is located at C:\Windows\System32\drivers\etc and can be opened with a text editor like Notepad.

In some cases, modifying the host file for other purposes can inadvertently cause this SQL Server login error. To fix the issue, you can add an entry to the host file that maps the IP address 127.0.0.1 to the hostname “localhost”. This can be done by adding the following line to the host file:

127.0.0.1 localhost

Once you have added this entry, save the host file and try reconnecting to the SQL Server. In most cases, this simple fix should resolve the login error and allow you to connect to the server as usual.

It’s important to note that if you are part of a domain and your organization is using active directory, there may be additional factors at play. In such cases, ensure that your account is properly added to active directory and has the necessary security permissions to execute the task.

Next time you encounter the SQL Server login error stating that the login is from an untrusted domain, remember to check your host file for any modifications that might be causing the issue. By adding the appropriate entry, you can quickly resolve the error and regain access to your SQL Server.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.