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

Recently I have got two desktop computers at home and both of them are very powerful machine.

Machine 1 : Windows Vista SP1 with SQL Server 2008
Machine 2 : Windows 2003 with SQL Server 2005 with SP2

When I was trying to connect from SQL Server 2008 to SQL Server 2005 using Windows Authentication I was getting following error.

Login failed for user ‘UserName’. The user is not associated with a trusted SQL Server connection.

To resolve this error follow the steps below on computer with SQL Server 2005.

  • Create new user with Administrator privilege with same username and password as of SQL Server 2008 in operating system.
  • On SQL Server database create new user by expanding DatabaseNode >> Security >> Login >> Create New User and add this new user with Windows Authentication radio button selected. This user can be only added by selected Windows Authentication it is Operating system’s User Login.

Once above two steps are completed when connected from SQL Server 2008 to SQL Server 2005 using Windows Authentication it will connect successfully.

Reference : Pinal Dave (http://www.SQLAuthority.com)

SQL Error Messages, SQL Server, SQL Server Security
Previous Post
SQL SERVER – Stored Procedure WITH ENCRYPTION and Execution Plan
Next Post
SQLAuthority News – SQL Server Security Whitepapers

Related Posts

11 Comments. Leave new

  • hello
    i want connect to sql server 2000 sp3 with a windows ce device.

    can you help me about how connect to sql server with wireless network.

    and I connect to sql server with

    SqlConnection SqlCon = new SqlConnection(“Data Source=dell,1433;Initial Catalog=northwind;User ID=sa;Password=123;”);

    but show this error : 17
    sqlException

    thank.

    Reply
  • even i faced that but between 2000 and 2005.
    but when i restart my sql server it fixed .

    Reply
  • Whenever i try to connect to server i get sql server error 18452 then 18456

    I created new login from security general page and
    enabled it.But the default password is not going.
    Then i went to query window.ALTER LOGIN sa ENABLE
    GO
    ALTER LOGIN Sa WITH PASSWORD=” i did
    It is giving error 18452 this time.

    Reply
  • try to connect to server i get sql server error 18452 then 18456

    I created new login from security general page and
    enabled it.But the default password is not going.
    Then i went to query window.I wrote ALTER LOGIN sa ENABLE
    GO
    ALTER LOGIN Sa WITH PASSWORD=’
    It is giving error 18452 this time.

    Reply
  • hello,
    i am creating new login through query in sql server2000. can you help me how to create login user through query

    Reply
  • Please check the Authentication mode of SQL Server.

    If it is in Windows, please change it to MIXED mode and try to connect using with the SQL Server Login.

    Reply
  • It works!
    As my testenvironment is similar like your example and I do not have a Windows domain I was searching what needs to be done, to use Windows authentication.
    Your steps worked perfectly.
    Thank you Pinal.

    Regards
    Thorsten

    Reply
  • hello my friend…………
    i create new login with SQL Server Authentication , but when i want connect to server with this new login , it has error:
    “cannot connect to ‘servername’ “……”login failed for user ‘username’ ” (microsoft sql server , error : 18456)
    i enter correct username and password.

    help me :(………………..

    Reply
  • The 10-14 inch collars are most commonly used with dogs
    like Jack Russell Terriers, Shelties etc.
    This gps system functions just like the ones in your car and this way, it helps to maintain
    a safe hold over your pet. Once in place, tthe chip can be
    detected using a handheld scanner that then displays the unique code.

    Reply
  • VCL. I don’t connect, login to SQL, what the hell change Security???

    Reply
  • Hello – I have a c# code which connects to DB and executes a SP (updates one table). But I get the following error: Login failed for user ‘Domain\Username’ both in SSMS and in Visual Studio exception. Can you please let me know what should be done, to fix this error?

    Note: All other procedures are running fine (both from SSMS and VS) except this procedure.

    Thanks
    Aravind

    Reply

Leave a Reply