Login failed for user ‘username’. The user is not associated with a trusted SQL Server connection.
This error occurs when you attempt to login to SQL Server using SQL Server Authentication mode (username + password) when the SQL Server instance is only configured for Windows Authentication.
To fix the issue:
- Enable SQL Server Authentication
- Enable the “sa” user, and configure a password for it
- Restart the SQL Server Instance
1. Enabling SQL Server Authentication (or mixed authentication mode)
a) Open SQL Server Management Studio
b) Connect to the server using Windows Authentication
c) Right click the “Server” node in the tree (the top level node), and select properties
d) Select the Security page and select “SQL Server and Windows Authentication mode” as the “Server Authentication” value.
2. Enabling and setting the password for the ‘sa’ login
a) Run the following SQL statements against the master DB:
ALTER LOGIN sa WITH PASSWORD = 'the password'
GO LOGIN sa ENABLE GO
b) Expand the Security node in the SQL Server Management Studio and right click the “sa” user, and select “Properties”, and then on the “General” page provide a password, and on the “Status” page select “Enabled”.
3. Restart SQL Server Instance
Right click on the server node in the SQL Server Management Studio again, and select “Restart”. All the changes should now take effect.