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
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 (https://blog.sqlauthority.com) , BOL
196 Comments. Leave new
when we are running the insert statement with the linked server, it is working fine.
If i create the job , it is failing with the folowing error
Executed as user: SYNTEL\user1. Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection. [SQLSTATE 28000] (Error 18452). The step failed.
We are getting the error in sql 2000.
Regards,
D.RamaKrishna
I am having the error
“Login failed for user ‘sa’. The user is not associated with a trusted SQL Server connection.”.
I have Windows XP Service Pack 2,
I have MS SQL 2005 Express,
I can have either ‘Windows Authentication’ or ‘SQL server Authentication’ in SQL.
I have MS SQL Server Compact 3.5 Design, ENU,
I have MS SQL Server Native Client
I have just removed passwords for sa, and my login in the SQL server.
How can I solve this error please?
Thank you.
Solved.
The connectionstring line was at fault, it should have been
connectionString=”Data Source=.\SQLEXPRESS;INITIAL CATALOG=HandScanning;Integrated Security=SSPI;User Instance=False”
Instead of “Integrate Security=SSPU;user instance=false, ”
I had “id=PC\Aministrator;pwd=”
So this error can also relate to errors in the constuction of the
connectionstring
This advice is great unless you are ALREADY in mixed mode on SQL 2005 and STILL receiving the same error. The services HAVE been restarted and STILL receiving the same error. I am using Rightfax. It is trying to alert the database that the fax was successful. My System DSN (ODBC connection) verifies fine using SQL user and password, but when the Rightfax program goes to run the process, It gives me the dreaded User not associated error and the user is ”. This is maddening! I have spent two full days so far, but all I find is change the mode to mixed mode, I am already there!
I have already change the mode to “SQL Server and Windows Authentication mode” but I am still getting the error of “The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452).
Why is that ?
I have solved the problem, after changing the connection to “SQL Server and Windows Authentication mode”, I need to stop the SQL Server Service and SQL Server Agent Service and restart them.
Hi,
I too have the same problem. So long i am getting errors for SSPI handshake and login failed for the user etc. This blog was very helpful.. Thanks a lot…
For me, the solution was the host had two DNS names. So, I had changed the DNS to the same which is recognized under Network (My Computer –> Properties –> Network Identification) in client network utility. (Run –> cliconfg). Restart the SQL Server. It won’t show any more errors in Agent log & event viewer … It will allow windows authentication also…
Mine turned out to be a change to a registry key for Rightfax. I had to include a user and password in the registry key. Apparently Rightfax only looks at the ODBC driver for the server name, why bother at all?!
How could I run this code in Query Analyser if I’m unable to login to server?
also deals with this. The server may have to be set to support Mixed Authentication for non Windows Authentication logins to work. The install default is Windows Authentication only I think.
Thanks a lot for your article, it helped me to solve the problem. Good job!!!
Great Site. My PC had been renamed. “kaleeswar B” was correct. This caused the error. Many thanks for the advice.
Hello, I’m faced with the following problem. We are one of many applications that are being deployed to hundreds of sites. The help application is developed by one group and we have to use their help. Our application is using asp.net 2005 and SQL Server 2005. When we call the help application then try to navigate in our application we sometimes get the error below. It is random and it only effects users who are not administrators on the server. Intially our application was opening a new window for the help, after the user closed the window it would cause this error. I’ve embedded the help into our application, but that still didn’t work.
Our connection string in the web.config is:
I changed the connection string to include some of the following, but it didn’t make a difference.
Max Pool Size=200; Connection Lifetime=10000; Connection Timeout=120;
11/24/2009 8:55:07 AM|E:\InetPub\WWWRoot\FLTMPS\LOGOUT.ASPX|Login failed for user ‘COMPOSE3\James.Smith’.| at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at fltmps.FLTMPSCommand.FLTMPSDeleteTmpSel(String Oracle_Connection_String, String strSessionID)
at fltmps.Logout.Page_Load(Object sender, EventArgs e)
Any help would be greatly appreciated.
Thank you very much,
Lorie
Hello pinal im not getting the solutionof this error in sql server 2005…
error is Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
Hello Anish,
Please provide us the information for following questions:
How are you trying to connect to server I mean from SSMS or using linkedserver or from some application?
Where from you are trying to login, server machine itself or from remote computer?
Is this error coming for some specific login or for all logins?
When this error started occurring?
Regards,
Pinal Dave
May be this will be the most weird case:
my co-worker can use windows login to connect to all servers except this one (say, named OperationServer) from his own computer.
It will gives the 18452 error.
However, login on other’s workstation using his login won’t throw error. Meaning the login and security are good.
All other co-workers don’t have problem with this OperationServer with windows authentication.
Hi Saiman,
Every SQL Server instance has its own security and login on one server does not gaurantee to login on all servers. Please verify that on SQL Server, an enabled login having proper rights exists for user.
Also verify that defult database for the user is available on server.
Regards,
Pinal Dave
I had the same problem and tried almost all the tips in this thread and others around the Internet. However, none of them were useful for me. In my development environment I had been using a connection string which used a DNS name (Host A record, as a matter of fact) pointing to the IP of the server where SQL 2005 is installed.
After trying several things, I finally went to the web.config and changed the connection string to the server name. After this, I got another message: Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’. [CLIENT: ]
I had seen another article saying to give this user access to the data base under User Mappings and after that all worked like a charm.
Hope this is helpful for anyone.
I am trying to connect my client machine with sql server but the error thrown each time is
Connection :failed
SQL State : 28000
Sql Server Error : 18452
[microsoft][sql server driver][sql server][login failed for user null.
Reason : not associated with the trusted sql server connection.
I have tried to change the above process described (Security-Login—–]
and the second problem is its showing the name of server two times in the same list .. so is it conflicting with the server detection.
I appreciate your feedback
Thank you