SQL Error “Login failed for user <user name>. The user is not associated with a trusted SQL Server connection” is quite common. The problem is that SQL Server cannot identify user name. This is how the error message looks like.
What are the Most Common Reasons?
- Incorrect login or authentication type (Windows vs. SQL)
- Login is not set up on SQL server (admin can solve this by creating an account and assessing rights)
- We are logging to SQL Server instance using SQL authentication which is not allowed on the server
Reasons 1,2 can be solved easily without more work. However, reason 3 can be a struggle.
SQL Server Authentication Methods
User can log to SQL Server in two ways
- SQL Authentication: login is on SQL Server set up manually. This will work if this type of login is allowed above SQL instance. Setting can be done (i) during SQL Server installation or (ii) in settings whenever after the installation (read further). User name and password is needed.
- Windows authentication : (set as default) is a second way. Here, we log in under our domain name (windows account). No name or password needed.
SQL Server Accepts Login Only Under Windows Auth Mode
Already mentioned error Login failed for user <user name>” SQL Server issues in case we try to log in using SQL login of type that is not allowed in settings. What to do about it?
1) Change can be done in settings (properties) of SQL instance
2) Go to section Security and mark SQL Server and Windows authentication mode selection
Did it help? Let me know in the comments if you still have troubles.