SQL Error: Login Failed for User – What to do?

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.

Login failed for user

What are the Most Common Reasons?

  1. Incorrect login or authentication type (Windows vs. SQL)
  2. Login is not set up on SQL server (admin can solve this by creating an account and assessing rights)
  3. 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

  1. 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.
  2. 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.

5/5 - (2 votes)
Category: SQL Administration

About Ing. Jan Zedníček - Data Engineer & Controlling

My name is Jan Zednicek, and I have been working as a freelance Data Engineer for roughly 10 years. During this time, I have been publishing case studies and technical guides on this website, targeting professionals, students, and enthusiasts interested in Data Engineering particularly on Microsoft technologies as well as corporate finance and reporting solutions. 🔥 If you found this article helpful, please share it or mention me on your website or Community forum

Leave a Reply

Your email address will not be published. Required fields are marked *