Some errors never got old. I have seen many new DBA or Developers struggling with this errors.
Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
Fix/Solution/Workaround:
Change the Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)”
to “Mixed Mode (Windows Authentication and SQL Server Authentication)”.
Run following script in SQL Analyzer to change the authentication
ALTER LOGIN sa ENABLE
GO
ALTER LOGIN sa WITH PASSWORD = '<password>'
GO
OR
In Object Explorer, expand Security, expand Logins, right-click sa, and then click Properties. On the General page, you may have to create and confirm a password for the sa login. On the Status page, in the Login section, click Enabled, and then click OK.
Reference : Pinal Dave (http://www.SQLAuthority.com), BOL






Your article really helped me - I forgot my ’sa’ password and your script helped me change it.
Thanks Again!
Hi,
Your article really helped me. I really appreciated that.
Thanks,
Manoj
I am getting this error when try connecting with SQL server 2000 using Query Analuzer on XP machine.
Server: Msg 18452, Level 16, State 1
[Microsoft][ODBC Server Driver][SQL Srver]Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
Your artical really help me, when I am trying this in the production. Because I wrongly selected Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)” with the help of your script I have change to “Mixed Mode (Windows Authentication and SQL Server Authentication)”, its work out…
Hi,
why should I change the authentication??
Actually, I am trying to run a query thru linked server. I linked the server by windows login and my target SQL server is running under windows authentication only and I am getting the same error.
Please clear my doubt why should we use only mixed mode? Why it is not working with windows authentication, even I am using a domain account to connect?
Rizwan,
There should not be any need to change the authentication in theory. However, this error is quite generic and this way it can be fixed first and then you can work backwards towards your original configuration and see what is the issue.
Regards,
Pinal Dave (SQLAuthority.com)
I am using linked server and getting same error when trying to access linked server. I have Server1 with linked Server2. I am connected to Server1 using management studio remotely and trying to access linked server Server2. If I connect locally to Server1 and try to access linked Server2 this works. Any help will be appreciated.
Hi,
Things were working quite happily locally on my machine with Windows Authentication .. I tried setting up an ODBC connection to the database; this did not work
Upon trying to reaccess the database, via SQL Server Management Studio, the system reported, “Login failed for user . The user is not associated with a trusted SQL Server connection”
Luckily I was able to connect using 127.0.0.1 rather than my machines DNS name and was able to create the sa account to regain access. How is it then that I re-enable Windows Authentication mode?
Thanks
mrplatypus ..
This is for WINDOWS AUTHENTICATION:
I received this error when connecting to the SQL Server remotely via my application. After researching, I found that you had to both enable trusted authentication on my SQL Server machine and grant the User Right “Enable computer and user accounts to be trusted for delegation” (Group Policy…under Local Policies\User Rights Assignment) to the Windows account you are using. I just granted it for the Administrators group.
For the SQL Server machine, I set the property in Active Directory (check the box labeled “Trust computer for delegation” in the computer’s properties).
Make sure you for the group policy changes (gpupdate /force).
I have clustered SQL 2005 Enterprise 64 bit and SQL 2005 SP2 on a Windows 2003 server and I can log in fine with domain credentials, but not with ’sa’. SQL is installed in mixed auth mode and has all the default protocols, including Named Pipes and TCP/IP. I get error 18452 and I have read many, but not found any articles or discussions on the Internet or from Microsoft that solves the problem. My head hurts.
Any help is appreciated.
I’m trying to switch from windows authentification mode to sql server authentification.
Have doen all as you’ve written.
and it still gives me error Error 18452 (not associated with a trusted sql server connection)
Frank Stevens, could you be more specific, where to change theese policies and other things form you post.
Are there any problem if the server is on different network than client?
In my scenario my client is working into a network without Windows servers (so any AD is running or required for validation) but the SQL server (that is an SQL server 2000 SP3 running on a Windows 2003 server R2) is into another network WITH AD.
The connection is transparent through router. All other network services runs fine between both networks.
I’ve followed all steps but I’m still having the same problem.
2 clients running same OS with same ODBC have different behaviors. The client connected on same server’s network runs fine but the other one raises this error.
Any help will be appreciated
Please check the Server name is in Sink with server name of SQL Server. The host name should be the same as
Select @@Servername. If they are not the same, then use SP_Dropserver ‘oldServername’ and then Supply SP_addserver ‘Servername’,'Local’. then restart the server (OS) to take effect.
sql express05 does allow me change password when
iam logged with windows authentification,on next restart doesnt allow me to login with sa(by the way it shows some long password with asterixs).meaning it is not changing the password and
reports below error.this is LOG
TITLE: Connect to Server
——————————
Cannot connect to BLEEDING-DESKTO\SQLEXPRESS.
——————————
ADDITIONAL INFORMATION:
Login failed for user ’sa’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
—————–
any way to change to mixed mode authentification?
This is nice work around .
It helped me ‘N’ times .. i did it several times on several times ..for got the solution referred this article and got back to work and implemented it .
Thanks
Ravi Srinivas
Hi,
I fogtot to create sa authentication mode at the time of installation. How to create sa authentication. Is it possible at this time. I am able to access windows authentication only. Pl
I have an ASP.NET 2.0 Application on machine A. I am using forms authentication with Active Directory. My SQL 2K database is on machine B. On machine A, I can access my application, with no problem. When i try to access the application over the network from different machines, i get this error.
Server Error in ‘/EXACT-WHRM’ Application.
——————————————————————————–
Login failed for user ’sa’. Reason: Not associated with a trusted SQL Server connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user ’sa’. Reason: Not associated with a trusted SQL Server connection.
======================================
please help. am at my wits end.
moseti
I discovered that I had to restart the Sql Server service on my local machine to allow sql server authentication to work.
thank u very much for your article…
it really helping me
I am finding the issue while try to connect/create database in SQL Server 2005 from different application.
Login failed for user ’’. Reason: Not associated with a trusted SQL Server connection.
I tried with the above mentioned but it is failing to connect.
Pointers please.
Regards,
Dev
Hello,
i am using sql server 2005 and installed in mixed mode withe user name sa and password #sa
and from Sql Server Surface Area Configuration i select the Using both TCP/IP and named pipes for remote settings under Database Engine
version is [@@version]
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Evaluation Edition on Windows NT 5.1 (Build 2600: Service Pack 2)
My os is Xp with service pack2
I am using asp.net 2.0 and using connection string in web.config
SOURAV is my local Database Server name.
I can connect server with the user name password from the SQL Server Management Studio,
But the problem arise when i hit con.open() from asp.net page
error message show login failed for user ’sa’
Please help how to solve,
Thanks in advance
Sourav
the sql server registertration failed user and the two user in different operating system but in the same network group
I have the same problem, but in my case, changing to Mixed Mode authentication did not fix the problem.
I can login under Windows Authentication without problem, but any attempt to use SQL Server Authentication results in the “not associated” error.
I have also tried using the “sa” account, changing “sa” passwords, and even dropping password policy on the “sa” account… no joy. I have also tried creating new users, with explicit server authentication permission and passwords, but still no luck.
Any suggestions?
hi
I am trying to configure log shipping on sql server2000 on a domain with a machine with same sql server 2000 on different domain but i m getting the error :
Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL Server ‘ANKUR-BZOPEK2PX’ as ‘ANKUR-BZOPEK2PX\sqladmin’ (trusted)
Starting maintenance plan ‘log_ship’ on 3/18/2008 10:20:00 AM
[1] Database log_ship: Transaction Log Backup…
Destination: [E:\backup\log_ship_bakup\log_ship_tlog_200803181020.TRN]
** Execution Time: 0 hrs, 0 mins, 1 secs **
[Microsoft SQL-DMO (ODBC SQLState: 28000)] Error 18452: [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
[2] Database log_ship: Delete Old Backup Files…
0 file(s) deleted.
Deleting old text reports… 0 file(s) deleted.
End of maintenance plan ‘log_ship’ on 3/18/2008 10:20:00 AM
SQLMAINT.EXE Process Exit Code: 0 (Success)
please suggest me
thankyou
but still my problem persists,Error:18452;trusted connection
thanks it solves my problem.
may you have to chek in the propriete of the server on the consol management sql express the tab securité
Another thing to check is the information you add to your Add Connection box.
Make sure you have the correct path of the servername. You may need to do something like this: MYCORPSERVER/SQLEXPRESS
The wrong path will also give that ugly “Login failed…” error
hiiii
i have given the userid as “sa” itself…..and mode of authentication is mixed mode itself……but still i am getting the error…..”login failed for the user ’sa’ ” while connecting to sql server.
hai
thanx for ur help
The problem is usually the security tab in the link server.
use the correct connection setting.
I always recomend login maping and use the current login security context. hope this help. :-)
Really lots of Thanks for this solution.
I m facing this problem from long time and had no solution.
This is really working solution which works for me.
Thank you very much.
Post this kind of Fixes of error in future.
Hi,
Problem:
I am getting this error when try connecting with SQL server 2000 using Link Servers on XP machine.
Server: Msg 18452, [SQL Srver]Login failed. Reason: Not associated with a trusted SQL Server connection.
Solution:
Corect My DNS (Main Domain) and Change the Authentication Mode of the SQL server from “Windows Authentication Mode (Windows Authentication)”
to “Mixed Mode (Windows Authentication and SQL Server Authentication)”.
Thanks,
Mahesh.
Hi
Thank you for the solution. I tried many ways to change the authentication mode from Windows to Sql Server Authentication mode. But there is no use. But after trying the above, the problem solved immediately. Thank you for the code.
hi
I am using Vista as an OS. I am currently working on VS 2005 and SQL Server 2000. i am tired of working wiht this error and m really screwed up. can u please help??
Login failed for user ‘Anubhav-PC\Anubhav’.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException:
Login failed for user ‘Anubhav-PC\Anubhav’.
Source Error:
Line 48: cn = New SqlConnection(”data source=localhost;initial catalog=payroll;integrated security=sspi;”)
Line 49:
Line 50: cn.Open()
Line 51: eid = TextBox1.Text
Line 52: ename = TextBox5.Text
I have tried creating a new user named ‘anubhav’ and have changed mode to Mixed. Yet the problem persists.
Please help!!!!
Thanx in Advance
Anubhav
Hello sir,
I am getting following error when i m creating system dsn for sql server 2005.
I HAVE ASLO DONE THE AUTHENTICATION MODE FROM WINDOWS TO MIXED MODE.
Connection failed:
SQL state: ‘28000′
SQL server error:18452
[Microsoft][ODBC SQL server driver][SQL server] login failed for user ‘asdf’. User is not associated with a trusted SQL server connection.
Hi All
i am using SQL Server 2005 SP2 mixed mode of authentication is in use still getting this error
Login failed for user ”. The user is not associated with a trusted SQL Server connection
Error: 18452, Severity: 14, State: 1.
any help will be appreciated.
Regards
Hi,
This article is useful but because of some security requirements we have to use windows authentication only. So, i wanted to ask whether there is a possiblity to solve it by using the windows authentication mode.
Thanks.
Hi All,
Me also facing this kind of problem. I executed the following sql statement. But still I am getting ”
” Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword ‘user’. ”
while runing this SQL statement. Please forgive me for this silly qstn. I am a new boy to this SQL Server world.
SQL Statement I executed :
ALTER LOGIN user ENABLE
GO
Thanks
Arun J
I have SQL SERVER 2005 (EXPRESS) running on my home desktop machine. However, on this desktop machine there is no Query Analyzer and neither SQL Server Management Studio. It’s my first time to use SQL Server 2005.
On my office laptop, I have SQL Server Management Studio. When I try to connect to the SQL server on my desktop machine, I get this error.
Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
Here is a screenshot of the error I am getting.
http://i303.photobucket.com/albums/nn134/s1mpl3k1d/sql_loginerror.gif
Any help would be greatly appreciated.
I don’t know if my error is the same as everyone else:
Access 2003 on a Windows Vista Pro PC. Everyone else can access the Access program on their PC but they have Windows xp. I have admin rights.
Since the user switched to Windows Vista Pro from XP, he gets Microsoft SQL Server Login error:
Connection failed
SQLState’28000′
SQL Server Error 18452
[Microsoft][ODBC SQL Server Driver][SQL Servr] login failed for user (null). Reason Not asscociated with a trusted SQL Servr Connection.
He was able to use the Access program before. I did set up the ODBC connection as I always do on everyone else’s pc.
I also tried to log into the sql server at the prompt with my userid and password as I have admin rights, but I still get the error. I also tried the administrator logon id / pw and still get the error.
Why can’t he use the Access database on Vista Pro? Is there something I need to download? Is there something I need to update from Microsoft?
Thanks in advance for any help.
Sorry, I didnt mention the version of SQL Server we have : 2000
OK just to update. I didn’t know that the user was not logging into the domain. The user was setup by our IT person to log into the local laptop for some reason.
Once the user logs into the domain it worked.
:D
Hi All,
while reinstalling the SQL server getting an error like all the components are already installed but there is no components are showing let any one give a solution for this problem.
To change security authentication mode
1.
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
2.
On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
3.
In the SQL Server Management Studio dialog box, click OK, to acknowledge the need to restart SQL Server.
Ref: http://technet.microsoft.com/en-us/library/ms188670.aspx
Dim linkTable As TableDef
Set linkTable = CurrentDb.CreateTableDef(tableName, dbAttachSavePWD)
linkTable.Connect = “ODBC;Driver={SQL Server};Server=SERVERNAME;” _
& “Database=DATABASENAME;Uid=USERNAME;Pwd=PASSWORD;”
linkTable.SourceTableName = tableName
CurrentDb.TableDefs.Append linkTable
Hello Sir ,
This article was really helpful .
But I am not able to connect to database from VB.Net using Windows Authentication . I am able to do it using “sa” account . Meanwhile I am also able to get in Sql Management Studio using local as well as sa account .
Mixed Mode Authentication Used
In the below code if i change UserId to sa then my task is accomplished .
Am I missing Something?????????
Code Used :
Sub Main()
Try
Dim cbs As New SqlConnectionStringBuilder()
cbs.DataSource = “Franklin”
cbs.Add(”Initial Catalog”, “Sharepoint”)
cbs(”Integrated Security”) = False
cbs.UserID = “Francis”
cbs.Password = “”
Dim conn As New SqlConnection(cbs.ConnectionString)
Console.WriteLine(”Opening Connection”)
conn.Open()
Console.WriteLine(”Connection Opened”)
Console.WriteLine(”Closing Connection”)
conn.Close()
Console.WriteLine(”Connection Closed”)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Console.ReadLine()
End Sub
SQLServer running on Win2k3. Ran sysprep to generate a new SID in attempt to fix blue-screen problem with domain authentication (another story…).
Anyway, since generating the new SID, Windows authentication to SQL Server is broken. The sa account is disabled. I can log in with a read-only SQL user and that is all I can do. The agent won’t start - fails to authenticate as Local System.
I need to re-initialize SQL security so I can log in via Windows (Administrator). Or enable ’sa’ somehow. Any ideas?
I tried to create new users from security login and give the database which allow the user access, but the user could not login from application. I do not know why?
Ting
I have developed ASP.net 2005 website. It has connectin with SQL server 2000 SP4. Whwn I run the site from VS 2005, it runs perfactly. But when I upload it on the IIS server (OS Win2000), the SQL server is not getting connected the error is… Not associated with trusted SQL Server connection.
I have tried will all following options :
1. Changed the authentication mode to SQL Server and Windows mode with audit option None.
2. Included Integrated security=SSPI in connection string
3. Included Trusted_Connection=True in connection string
4. Tried with user name and password in connection string
5. Created a new user and assigned dbo.owner permission to the user and provided user id and password in conncetion string.
Still the error persists.
Can anyone help me ???
thank you very much
this article really help me
Hello,
I have an Access 2003 DB with an ODBC connection to a SQL 2000 Server. There are about 4 different people with similar security rights who use this and 3 are able to use the db with no problem.
One person has the same error as described on this page
Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
This user claims that he usually does not log into the domain but he claims that in this case he was logged in and it still did not work. I submitted a ticket to IT to take a look at his account and they verified that he has admin rights to his PC.
Do you know why one person would have this error when others with the same security rights do not have problems? Would this indicate a domain issue perhaps?
Thanks,
Creed
Scenario: You are using SQL Server 2005/2008 management studio to connect to a SQL Server. In management studio, you are trying to set up a linked server. When trying to access the linked server, you receive the error message in this plog.
Problem: Because you are remotely connected to your SQL Server and trying to access a linked server, you are engaged in a double-hop authentication. IE, your credentials are passed to your SQL Server and your SQL server is trying to pass them to the linked server. This requires Kereberos authentication.
Solution: A domain admin must enabled delegation of your SQL server via Active Directory so your credentials can be passed through.
i have installed SQL SErver 2000, when i try connect using ‘SQL server authentication’ mode with ‘SA’ or my username, it is giving me 18452 - user not assoiciated with a trusted connection. i noticed ‘Mixed authentication’ mode set to disabled. how should i fix this issue?
Does anyone know what might cause this error to occur sporadically? I have a service which makes a connection every few minutes to several servers. If the connection fails, I get paged. Once it’s able to connect, I get paged again. This error is occurring randomly on a few of the servers; the service is able to reconnect after a few minutes. So I’ve had many sleepless nights lately!
Hi Sue,
I am having similar issues where my application would occassionally lose connection to SQL Server. After a few mins, the connection would be restored automatically but it is definitely cauing problems in the production environment.
My SQL is clustered but no failover occurred when the connection was lost.
Anyone can help? Much appreciated.
SQL Log says:
Error: 17806, Severity: 20, State: 2.
2008-11-03 07:54:25.63 Logon SSPI handshake failed with error code 0×80090311 while establishing a connection with integrated security; the connection has been closed. [CLIENT: 10.1.64.44]
2008-11-03 07:54:25.63 Logon Error: 17806, Severity: 20, State: 2.
2008-11-03 07:54:25.63 Logon SSPI handshake failed with error code 0×80090311 while establishing a connection with integrated security; the connection has been closed. [CLIENT: 10.1.64.41]
I am try to use the following script to open some linked tables from an SQL 2005 Server from a client with Access 2003. I can do it manually with no problem, but when running the script I get the following error.
Could not find installable ISAM
Can Anyone Help Me Please?
Option Compare Database
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Call LinkToSQL(”dbo_Batch”, “Riegos”, “dbo_Batch”, “AAA”, “sa”, “INFO121″)
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub
Sub LinkToSQL(strAccessTable, strDBName, strTableName, strDataSourceName, strUserID, strPassword)
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Set cat = New ADOX.Catalog
cat.ActiveConnection = CurrentProject.Connection
Set tbl = New ADOX.Table
tbl.Name = strAccessTable
Set tbl.ParentCatalog = cat
tbl.Properties(”Jet OLEDB:Create Link”) = True
tbl.Properties(”Jet OLEDB:Link Provider String”) = “OBBC” & _
“;Database=” & strDBName & _
“;UID=” & strUserID & _
“;PWD=” & strPassword & _
“;DSN=” & strDataSourceName
tbl.Properties(”Jet OLEDB:Remote Table Name”) = strTableName
cat.Tables.Append tbl
End Sub
I had this problem and was due to account being locked out.
To change security authentication mode
1.
In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.
2.
On the Security page, under Server authentication, select the new server authentication mode, and then click OK.
3.
In the SQL Server Management Studio dialog box, click OK, to acknowledge the need to restart SQL Server.