Trouble Connecting to sql server Login failed. “The login is from an untrusted domain and cannot be used with Windows authentication”

前端 未结 19 2784
闹比i
闹比i 2020-12-05 12:38

I am trying to host a SQL server database, but whenever I try to connect to it I get this error:

The login is from an untrusted domain and cannot be u

19条回答
  •  清歌不尽
    2020-12-05 13:09

    In order to use Windows Authentication one of two things needs to be true:

    1. You are executing from the same machine as the database server.
    2. You have an Active Directory environment and the user the application is executing under (usually the logged in user) has rights to connect to that database.

    If neither of those are true you have to do one of two things:

    1. Establish a Windows Domain Controller, connect all of the relevant machines to that controller, then fix SQL server to use domain accounts; OR,
    2. Change SQL server to use both Windows and SQL Server accounts.

    By FAR the easiest way is to change SQL Server to use both Windows and SQL server accounts. Then you just need to create a sql server user on the DB server and change your connection string to do that.

    Best case option 1 will take a full day of installation and configuration. Option 2 ought to take about 5 minutes.

提交回复
热议问题