[Fix] - Windows Auth Login Error The login is from an untrusted domain

Wikitechy | 1601 Views | sql server | 08 Jun 2016


Scenario :

  • When logging into SQL server the error occurs as:

Cannot connect to

Login failed. The login is from an untrusted domain and cannot be used

with Windows authentication. (Microsoft SQL Server, Error: 18452)

Reason for the error :

  • The error informs that its purely based on the invalid login account.

Fix1 :

  • In hosts file under C:\Windows\System32\drivers\etc\hosts, under localhost name resolution, it may be present as   

 Update it as shown below:   localhost

Fix 2 :

  • Make sure that the system is not connected to a VPN on another domain\user. If connected use appropriate user credentials.

Fix 3 :

  • In few cases, the SQL Server 2008 is hosted on a workgroup computer that is different from the current domain. So go to System Properties -> Computer Name (tab) -> Change (button) -> Computer Name Change -> More... (button) and provide the "Primary DNS suffix of this computer" and select the option "Change primary DNS suffix when domain membership changes". This allows the Windows Authentication process to complete when logging into the SQL Server 2008 on different domain.

Fix 4 :

  • Replace the connecting string to use SQL Authentication as follws


wikitechy_con = New SqlConnection("Data Source= [Server_Name]; Initial Catalog= [DB_name]; Trusted_Connection= True")


wikitechy_con = New SqlConnection("Data Source= [Server_Name]; Initial Catalog=[DB_name]; User ID= ‘xxx’; Password= ‘xxx’;")

Fix 5 :

1.Enable the default ‘sa’ account and login into SQL Server with SQL Authentication. 

2.After logging, go to security -> right-click on logins -> select new login -> select SQL Server authentication -> create a username with password and confirm the password and finally select default Database.

3.Go to logins -> right-click on the user -> select properties.

4.Go to Server Roles and select the roles desired for the new user.

5.Click OK and go back to login properties.

6.Click on User Mapping -> double-click on the database to map to the new user and select the database role.

Fix 6 :

use netonly option as follows:

runas /netonly /user:domain\user "C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\ssms.exe"

Fix 7 :

  • Disconnect (change workgroup/domain) and reconnect to Domain.

Fix 8 :

  • Change properties of network connection as follows:
  • Click on: "Internet Protocol Version 4 (TCT/IPv4)" -> Click "Properties" button -> Click "Advanced" button -> Select "DNS" tab -> Delete text in "DNS suffix for this connection".

Fix 9 :

  • The password for the default SQL user can be updated by other users on the same machine. Hence check and use appropriate password.

Fix 10 :

  • The user's password settings can have an expiry date. Hence change the password and reconnect.

Fix 11 :

  • User may sometimes does not have enough permission / role to access the SQL Database itself. Change those settings.

Applies to sqlserver version : 

  • SQL Server 1.1 (16 bit)
  • SQL Server 4.2A (16 bit)
  • SQL Server 4.2B (16 bit)
  • SQL Server 4.21a
  • SQL Server 6.0
  • SQL Server 6.5
  • SQL Server 7.0
  • SQL Server 7.0 OLAP Tools
  • SQL Server 2000
  • SQL Server 2000 64-bit Edition
  • SQL Server 2005
  • SQL Server 2008
  • Azure SQL DB
  • SQL Server 2008 R2
  • SQL Server 2012
  • SQL Server 2014
  • SQL Server 2016

Related Error Tags :

  • "Login failed. The login is from an untrusted domain..." (92135)
  • Error Message "Login failed. The login is from an untrusted domain 
  • SQL SERVER - FIX ERROR - Cannot connect to . Login failed. 
  • active directory - SQL Server Windows Authentication fails
  • Login failed. The login is from an untrusted domain and cannot be used with Windows authentication
  • SQL Server 2008 Windows Auth Login Error
  • Error Message "Login failed. The login is from an untrusted domain
  • Logging into Microsoft SQL Server 2008 R2 fails with the error 
  • Login failed. The login is from an untrusted domain and cannot be a windows.


Bug Bounty
IOT Hackathon

Join our Community