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
i installed sql2005(x86) on serve 2008r2
wen i connect with vb6 from winxp(x86) to sql i get error 10060
if any one know about this problem
thenk you yacov
@”Initial Catalog=AccountMenagmenta;Integrated Security=SSPI;Persist Security Info=False; Data Source=MAINSERVERSQLEXPRESS”;
this string i running in my three computer to connect Remote Connection to Server
but One Computer is showing me below Error
TITLE: Connect to Server
——————————
Cannot connect to MAINSERVERSQLEXPRESS.
——————————
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: TCP Provider, error: 0 – No such host is known.) (Microsoft SQL Server, Error: 11001)
For help, click:
——————————
BUTTONS:
OK
——————————
Hi im using Visual Studio 2008 & MS SQL SERVER Management Studio Express
i don’t know where is my error
Please help me out?
THIS IS MY REGISTER.
Imports System.Data.Sql
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
‘Dim connection As String = ConfigurationManager.ConnectionStrings(“Data Source=JED-PC;Initial Catalog=comicon;Trusted_Connection=True”).ConnectionString
Using cn As New SqlConnection
cn.ConnectionString = “Data Source=JED-PC;Initial Catalog=comicon;Trusted_Connection=True”
Dim c As String
c = “INSERT INTO Logins(First_Name,Last_Name,Password,Address,Contact_No,Email,Account) VALUES (‘” & TextBox1.Text.Trim & “‘,'” & TextBox2.Text.Trim & “‘,'” & TextBox3.Text.Trim & “‘,'” & TextBox5.Text.Trim & “‘” & “, ‘” & TextBox6.Text.Trim & “‘,'” & TextBox7.Text.Trim & “‘,’1’ )”
Dim sqlcmd1 As New Data.SqlClient.SqlCommand
sqlcmd1.Connection = cn
Try
cn.Open()
sqlcmd1.CommandText = c
sqlcmd1.ExecuteNonQuery()
cn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
If TextBox6.Text.Length < 7 Then
MsgBox("contact # is too short")
Else
Button1.Visible = True
MsgBox("Your Successfully Registered", 6, "Confirmation Message")
Response.Redirect("Login.aspx")
End If
End Using
End Sub
End Class
(When I Submit it won’t redirect to other..)
Imports System.Data.Sql
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connection As String = ConfigurationManager.ConnectionStrings(“Data Source=JED-PC;Initial Catalog=comicon;Trusted_Connection=True”).ConnectionString
Using cn As New SqlConnection
Dim Account As String
Dim login As String
login = “Select count(*) from Logins where Email = ‘” & TextBox1.Text & “‘ and Password = ‘” & TextBox2.Text & “‘”
Dim sqlcmd1 As New SqlCommand(login, cn)
Try
cn.Open()
Account = sqlcmd1.ExecuteScalar
If Account = 1 Then
sqlcmd1.CommandText = login
Account = sqlcmd1.ExecuteScalar()
cn.Close()
Select Case Account
Case 0
MsgBox(“welcome admin”)
Session(“Logins”) = TextBox1.Text
Response.Redirect(“/planetcomic/user/admin/Home.aspx”)
Case 1
MsgBox(“You are Succesfully Login”)
Session(“Logins”) = TextBox2.Text()
Response.Redirect(“/planetcomic/user/customer/Home.aspx”)
Case Else
Label6.Text = “Invalid Login or Password”
TextBox1.Text = “”
TextBox2.Text = “”
Label6.Visible = True
cn.Close()
‘If sqlcmd1.ExecuteScalar = “1” Then
‘Session(“Login”) = TextBox1.Text
‘Response.Redirect(“/planetcomic/user/customer/Home.aspx”)
End Select
End If
Catch ex As Exception
MsgBox(“Welcome to Planetx”)
End Try
End Using
End Sub
End Class
There is still an error raised while I’m trying to solve the problm using this method. BUt there is another way to overocme this problem by checking wheter your password has been expired.
I restarted my computer and change the pasword and the problem solved.
Initial problem resolved but now getting error “a connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)”
hi
i am new to sql dba
can anyone help me the difference between login and user. i am tring to create login with windows authentication but in vain.
Hi Pinal,
I have read many of your wonderful blogs.
I am running SQL 2000 Standard edition (SP3) and am getting the error though the instance is in Mixed authentication mode.
I am trying to access the SQL server from the domain A while the SQL server is in Domain B. But I know that both these domains trust each other and we have other servers in domain B which are accessible from the server in domain A.
Your resolution would be a turning point to me.
If none of solutions works… try this:
1. Open “Object Explorer”
2. Right click on instance name
3. Properties
4. Select a page “Security”
5. On ‘Server authentication’, select ‘SQL Server and Windows authentication’
After that you MUST restart the SQL instance service and, sometimes the SQL Browser.
Just this procedure really helped me (however, maybe is not the only one).
Hello,
I have scripts develped on access 2003 linked to SQL server 2000, and now, the SQL server has being upgraded to 2008. Now every time I run the query an error box appears:
Run-time error ‘-2147165949 (8004d903)’:
[Microsoft][SQL Server Native Client 10.0][SQL Server]To connect to this server you must use SQL Server Management Studio or SQL Server Management Objects (SMO)…
Anyone has a clue on what do I need to do to get this connection??…
Thank you very much!
can you please send me a MYSQL configuration pdf to my mail box.PLEASE…thanks
please write in details were i can go on windows 7 proffesionl
TITLE: Connect to Server
——————————
Cannot connect to CHRISTIAN-PCSQLEXPRESS.
——————————
ADDITIONAL INFORMATION:
Login failed for user ‘sa’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)
For help, click:
——————————
BUTTONS:
OK
——————————
Thank you for your article, it’s help me to solve my problem.
May database is get connected for the graph but doesent availabel for manipulation
@ Sukh,
You said, you have two databases one on SQL Server 2008 R2 and other on SQL Server 2008, is that right.
And you mentioned, When Users Log Off, then their login works, Can you tell me which Log off you are referring to, OS Log off or Application Log off.
Do Users connect to database directly using SSMS or through an Application, Does that Application uses Windows Authentication or SQL Authentication.
Please provide more details. And Please be clear… Your explanation is bit confusing.
~ IM.
Imran, We have only one database SQL2008r2 and the log off is from OS not the application.
User connect through the application with window authentication.
Please tell me if you have any question. I am tired of this error.
Thanks
I jst finished installing sql 2005 and m not able to long in for the first time. it gives me erro 26-
I’m Sankar working in a software company,_____
I’m having the error while running the below query in sql 2000
SELECT a.*
FROM OPENROWSET(‘SQLOLEDB’,’jil1′; ‘sa’; ”,’SELECT * FROM whmmaindb.dbo.temptag’) AS a
I used this for inserting data from one database to another ,But i got the error
Server: Msg 18452, Level 14, State 1, Line 1
Login failed for user ‘sa’. Reason: Not associated with a trusted SQL Server connection.
please help me,….!
I had the problem that I could log in as sa but when I tried my windows account I got that error about not being associated with a trusted connection even though my windows acount had all the necessary permissions.
Turned out that when we changed our domain server the database server had been left using the wrong DNS server IP Address and so all we had to do to fix this was change the database server’s network connection to use the correct DNS server IP address for the new domain.
Hope this helps someone.
Hi pinal,
i’ve installed sql server 2008 R2 on windows 2003 server successfully. Later i’ve created a sql login (eg: laddu) and tried to access the sql server with the sql login created. But i’m getting an error stating that “Login failed to connect to sql server”. i’ve tried many times, but unable to success. please help me out with this problem.
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?