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

前端 未结 19 2791
闹比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:29

    Just adding my suggestion for a resolution, I had a copy of a VM server for developing and testing, I created the database on that with 'sa' having ownership on the db.

    I then restored the database onto the live VM server but I was getting the same error mentioned even though the data was still returning correctly. I looked up the 'sa' user mappings and could see it wasn't mapped to the database when I tried to apply the mapping I got a another error "Fix: Cannot use the special principal ‘sa’. Microsoft SQL Server, Error: 15405". so I ran this instead

    ALTER AUTHORIZATION ON DATABASE::dbname TO sa

    I rechecked the user mappings and it was now assigned to my db and it fixed a lot of access issues for me.

提交回复
热议问题