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.

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

SQL Error Messages, SQL Scripts, SQL Server Security
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, 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.

    Reply
  • 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?

    Regards,
    Ankit

    Reply
  • 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.
    narendra

    Error Details ————->

    TITLE: Connect to Server
    ——————————

    Cannot connect to SCIL-SINGACH.

    ——————————
    ADDITIONAL INFORMATION:

    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:

    ——————————
    BUTTONS:

    OK
    ——————————

    Reply
  • 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.

    Reply
  • 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)

    Reply
  • 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

    Reply
  • 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.

    –Subash

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

    Reply
  • 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..

    Reply
  • 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 !

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

    Reply
  • thx a million

    Reply
  • Dear All,

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

    Will work.

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

    Reply
  • Microsoft SQL Server, Error: 123

    Reply
  • @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..

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

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

    hi

    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

    regards

    Harris P Nair

    Reply
  • 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

    Reply
    • 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.

      Reply
  • hi Pinal i am very new user to sql-server, I’am using sqlserver SQL 2005 Express Edition on my computer with windows authenticationm mode. i have created a user named “testUser” now i want to login with the user which i hve created bu when i try to login with “testUser” server gives an error.
    SQL SERVER – Fix : Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection.

    Reply

Leave a Reply