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 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
  • hi Pinal, im very new to sqlserver. I am using 2005 Express Edition with windows authentication mode. here i have created a new user named “testUser”. but when i’m trying to login with “testUser” server gives Error: 18452 Login failed for user ‘(null)’. The user is not associated with a trusted SQL Server connection. how can i login with “testUser”?

    Reply
  • I am getting this error on 2008 R2 when I am calling a SSRS report from another report. The report with the error has the same shared datasource as all the other reports and the dataset in the report is calling a stored procedure. This stored procedure is basically executing 14 different stored procedures in a sequential manner. Please note that all the stored procedures reside in the same database (no linked server or external server reference in the code). The SSRS reports are hosted on a different server from the database server. All reports run great except for this one report where I get the error
    “An error has occurred during report processing. (rsProcessingAborted)
    Query execution failed for dataset ‘NewRefreshMacroDataset’. (rsErrorExecutingCommand)
    Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.”

    Any help is greatly appreciated. I have tried all possible solutions listed in this blog but to no avail. Thanks in advance!!!

    Reply
  • i have local server which is running properly, but i fix static ip to that particular server machine, from that day it gives me error(login failed ‘sa’ user) after 2-3 days contentiously .pls help me.
    Regards Vijay….

    Reply
  • What’s up i am kavin, its my first occasion to commenting anyplace, when i read this piece of writing i thought i could also make comment due to this good paragraph.

    Reply
  • Hi All,

    I configured log shipping for four databases(SQL 2008r2) and for two databases the LS jobs are running successfully. Another two databases backup job was failed and the error is below.

    Message:

    2014-05-19 08:15:00.68 *** Error: Backup failed for Server ‘SERVERNAmE’. (Microsoft.SqlServer.Smo) ***
    2014-05-19 08:15:00.71 *** Error: An exception occurred while executing a Transact-SQL statement or batch.(Microsoft.SqlServer.ConnectionInfo) ***
    2014-05-19 08:15:00.71 *** Error: BACKUP LOG cannot be performed because there is no current database backup.
    BACKUP LOG is terminating abnormally.(.Net SqlClient Data Provider) ***

    NOTE:All the databases having the same configuration.

    please help me on this.

    Thanks,
    Sree.

    Reply
  • Hello I am so delighted I found your blog page, I really found you by error, while I was researching on Yahoo for something else, Anyways I am here now and would just like to say cheers for a tremendous post and a all round interesting blog (I also love the theme/design), I don’t have time to look over it all at the minute but I have bookmarked it and also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the awesome jo.

    Reply
  • While it’s usually a better picture than 720p, the “i” in 1080i suggests that it is an “interlaced” resolution which is not as smooth or clear as a 1080p “progressive-scan” picture. My personal opinion on this TV is that for the price, you can not beat $500 for a 32″ Hi-Definition TV. Sony will not give a clear alternative for accessing the 120Hz processing. You can either bring it to the manufacturer’s service center (which may entail some costs, if it’s no longer covered by warranty), or you could troubleshoot it yourself.

    Reply
  • thamnguyenit26
    March 31, 2015 2:07 pm

    Hi,
    I have a problem in my hosting, i just can connect to my sql server by string ‘Provider=sqloledb;Data Source=.SQL2008;User Id=user_db;Password=xxxxxxx’
    I can not connect with string ‘Provider=sqloledb;Data Source=127.0.0.1SQL2008;User Id=userDB;Password=xxxxxxxxx’
    I don’t know why. Can you help me ?

    Reply
    • thamnguyenit26 – What is the error? Also refer Errorlog if the SPNs are registered or not.

      Reply
  • Hello Sir,

    I am getting lot of message in sql audit logs on sql server as given below:
    +++++++++++++
    Pankaj-web Internet Information Services sa Audit Login Failed 130 Dec 9 2015 12:14PM
    Pankaj-web Internet Information Services sa Audit Login Failed 92 Dec 9 2015 12:12PM
    +++++++++

    What I understand is web server is trying to connect sql server through sa user
    but we do not any app on web where user” sa” is defined in connection string ..

    am unable to locate then why such weird message is coming in sql audit log

    we have separate sql and web servers

    Regards,
    Pankaj

    Reply
  • thanx dear

    Reply
  • Recently moved SQL server from desktop to virtual machine and now facing below error message while connecting the SQL server using SQL authentication.

    -2147205987:[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot execute as the database principal because the principal “guest” does not exist, this type of principal cannot be impersonated, or you do not have permission.
    The user ID ‘SQLADMIN’ is used to connect SQL server.

    May I know the permissions that ‘SQLADMIN’ should have to do BULK_COPY operation along with normal functions.

    Currently SQLADMIN is Set with ‘PUBLIC’ and ‘BULKADMIN’ permissions. For Database1 and Database2 [used in the project], SQLADMIN is given ‘PUBLIC’ and ‘db_OWNER’ permissions.

    After these changes, I am still facing the same issue.

    Reply
  • Hi,

    I am getting below error while login to SQL server 2014 Management studio:
    “[Microsoft][ODBC SQL Server Driver][SQL Server] Login failed for user name”

    Could anybody please help me out?

    Thanks!

    Reply
  • Doesn’t work :( I’ve been looking everywhere for a solution. I still get SQL State 28000 and SQL Server Error: 18452. Help! Help! Help!

    Reply
  • It’s doesn’t help at all. Any other advice that you can give for this please?

    Reply
  • I’ve tried everything to fix my login issue.
    Login failed for user ‘sqlserver’. ClientConnectionId:c20a5c21-e4f1-400c-a2a8-153b0489e8b1
    connect string is as follows:
    String connectionUrl = “jdbc:sqlserver://STEVE-PC\\SQLEXPRESS:1433;” +
    “Database=telematics;” +
    “User=sqlserver;” +
    “Password=SQLServer#1”;
    Any help would be greatly appreciated

    Reply
  • Pinal Dave,
    I used your technique to find the log file. However the connect errors are not there. I can use the “sa” logon id and get logged in but get “Invalid object name ‘telematics.ecm.ecm_actv_diag’. So I do not have my database defined to the sa account. OK I understand that. How can I use another account that has access to the database but can’t get logged in? I’ve tried to copy all of the parameters from the “sa” account to another but still receive “Login failed for user ‘sqltest’. ClientConnectionId:6216e682-5c52-4503-b0c8-91c1542e9d98”

    Reply

Leave a Reply