SQL SERVER – Fix : Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.

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.

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



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

, ,
Previous Post
SQL SERVER – Stored Procedures Advantages and Best Advantage
Next Post
SQL SERVER – CASE Statement/Expression Examples and Explanation

Related Posts

196 Comments. Leave new

  • Hi Pinal,

    Thanks for this post. I have a strange problem, I’m using a VB6 application to connect to a SQL Server 2005 database. I set up a DSN connection which I use in the code. It connects with no problem when the SQL Server is on the same computer. But when the database in on a remote server, it gives me the error “Login failed for user ”. The user is not associated with a trusted SQL Server connection.

    The SQL Server has Mixed Mode enabled, and when I set up the DSN it connects ok when I put in the correct sa login and password. However, when the VB6 application tries to connect using this same DSN, it fails with that error. What could be the problem?

  • Hi, If you’ll look for my post I think you’ll find your problem similar. Try making sure your SQL is looking for the username and password your system login uses.

  • Hi,
    We are about to DR setup using Window Server 2003 and MSSQL 2005 SP3.
    Our PRD and DR server domains are differ but they do have a trusted relationship between each other.
    DB restoration is completed on DR server but I am stuck when I am applying Log shipping method to make PRD and DR server in sync.
    At the point when I have to select DR as a secondary server, I am not getting my DR server name only PRD server name is there.
    While if I tried the same thing on DR server (just for check) I got PRD server SID as a secondary server.

    Could you please let me know how to resolve it?


  • hello Sir,
    i read all the problem and reply above but my problem very strange and unique .
    i install sql server 2008 operation system window2003 and sql database connected to attendance software.

    after installation sql server2008 running very well without any problem and login sucessfuly. but after 15 to 20 days sql server not login .

    so i uninstall and again new install sql server 2008 many time but this problem comes again reaptly after 15 to 20 days sql server not login .
    please help me to solved
    Thank you.

    Error Details ————->

    TITLE: Connect to Server

    Cannot connect to SCIL-SINGACH.


    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)

    For help, click:



  • OK, this is odd. new replacement machine everything installed fine, local administrator account can connect fine. PC user account can’t connect and won’t configure ODBC. I can’t see any issues with the account name etc, It’s a replacement machine so the account is an old one. workgroup not domain.

  • hi .im using TCP/IP address to connect pc to pc remote. anyone can help?

    1 pc stored the database. and .successfully connected.

    but the other pc can’t connect. i got this error
    Login failed for user ‘sa’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)

  • i installed sql server 2000 sp4 in windows 7 when i log in in Query analyzer a error occurred “unable to connect to server server:18452, level 16 stage 1

  • Hi Pinal,

    My problem may not be strictly related to SQL Server, but here is my problem. I connect to SQL Server in domain using my domain account. The domain account password expires every three months. I have changed the password several times in the past without a hitch. This time around, my account gets locked out periodically. I checked all the jobs in all SQL Servers in the domain to see if any of them is using my account. I found couple of jobs running ssis packages with credentials using my account. I updated the password on them and jobs run fine. However, I keep getting locked out periodically.

    I check the error longs and I find error message:
    Error:18456, Severity:14 State:11

    State 11 refers to “valid login but server access failure”.

    I tried changing back the password to previous password (which was working fine) but didn’t help.

    I also checked if any services are running under my account, didn’t find any.

    I hope you can guide me on to resolve this issue.

    Thanks in advance for you guidance.


  • thank you sir for the great information… it really helped me a lot

  • Hello Pinal Sir,

    How r u ?

    I have one problem. I have two SQL Server, e.g. ‘Server1’ and ‘Server2’. Server1 is connected with windows authentication and Server2 is connected with SQL Authentication.

    I am trying to create LinkedServer of Server1 in Server 2. but i am unable to do it because i don’t know how to create linked server of Windows authenticated Server.

    I enabled and set password of sa login of Server1. I again tried to create linked server of Server1 in Server2 by giving Server1 ‘sa’ login credentials as remote login and password. but still i am getting connection failed error in linked server. When i tried to create linked server of Server 2 in Server1 following the same steps, it created successfully. I was able to run SQL command from Server2 to Server1 using Linked Server.

    I am getting error like this.

    “A Network related or instance specific error has occurred while establishing connection to SQL Server. (Microsoft SQL Server, Error : 65535)”

    Please give me the solution..

  • Hello,

    i’ve been looking around for a solution to my issue but to no avail ! Here is the scenario:

    I am using Visual C# 2005 Express Edition and SQL 2005 Express Edition.
    I wrote a little C# windows application that is using a sql database. I tested it and published it locally and my application works locally, on, in my PC.
    Now, what i want is to be able to take this application (with all its related files to make it work after publishing) and put it (literally) in a another PC running Server 2003 so that people in my office can use this application from their PC through the LAN.

    The steps (that come from my readings in various online forums) i have done for that are:

    – i created a folder on a central PC (the one running Server 2003) and shared it so that users can access the .exe file and the related
    .mdf file along with the other linked files.
    – using SQL Server Management Studio Express (SSMSE) 2005, i changed my SQL instance (on that central PC) to allow remote
    connections and to allow for both SQL server and Windows authentication mode
    – i created a user account, on the central PC, through SSMSE -> Security -> Logins
    – i created a user: SQLServer2005SQLBrowserUser$SERVERNAME, through MY Computer -> Manage -> Local User Groups and Groups option
    – this is the connection string (took from the .config file):

    I guess that this connection string has to be changed (among other things) for my application to work on a LAN,
    would you mind helping me and show me the EXACT steps to carry out in order for my app to work on a LAN, PLEASE ?

    Thx a million !

  • Your tip were very usefull to me, thank you a lot!!
    Best Regards

  • thx a million

  • Dear All,

    For same query…we have to verify the “ERRORLOG” SQL log file and open SSMS server(RUN as ADMINISTRATOR)

    Will work.

  • Thank you
    You often benefited from the first error I found that completed the connection to the database
    Repeat, thank you very much

  • Microsoft SQL Server, Error: 123

  • @Mohamad..

    I need your help..

    Problem : When i do database connectivity through java with sql server 2008 i got error tha “sql server Exception : Login failed for ”

    I tried every thing..
    1)changed from windows authenticate mode to mixed mode
    2)enabme tcp/ip port
    3)set default port number 1433
    4)created database and gave access to that database for perticular login and use

    i tried all of above things but its not working..

    Please help me out..

    Thanks in advance..

  • i need to reinstall sql server 2008??? :(

  • Harris P Nair
    April 24, 2013 1:03 pm


    i was fighting with this error..finally i found a solution…now all works fine..

    try following steps..

    Set Guest account ‘turned on’ in server machine
    Add new login ‘servername\guest’ under Security > Logins in Sql Server
    Add this login to the databases accordingly
    Give required permissions


    Harris P Nair

  • hi friends i have used windows 7 64 bit and sql server 2005. when i run the program. i have found some errors

    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ‘IMRAN-PCIMRAN’.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Ontology.(Ontology.java:11)
    at ServerBoard.(ServerBoard.java:19)
    at Myserver.main(Myserver.java:19)

    How to solve that error

    • For this Case : SQL SERVER – Fix : Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.
      I try delete fin.zup and open nav app again.


Leave a Reply