Challenge: One fine day I got a new machine. I was very happy and started installing all stus I needed to work. I installed MSSQL server and Management Studio. I tried to login but failed and got below alert message.
Cannot connect to xxxxxxxxxxxxxxx. Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. (Microso SQL Server, Error: 18452)
It was then clear to me that every time we setup project or install soware needed to work we developers always face some minor and major issues, which is nothing but an opportunity to learn something 😊
Solution/Analysis: Here the hostname is showing 15 characters. When I checked the hostname in computer settings, it was 17 characters.
So, the actual hostname is of 17 characters but applications used to consider max 15 characters of hostname. I then realized there must be some standard limit for characters in hostname.
As per below link, max 15 characters for computer name is recommended.
https://support.microso.com/en-in/help/909264/naming-conventions-in-active-directory-forcomputers-domains-sites-and-ous
Since this was in my oicial system, I took help of my system admin to set 15 characters hostname. Then it started working. Login was successful.
Note: If you are still not able to login then reinstall SQL server and then try.
Hope this helps.
Good to read:
- https://community.spiceworks.com/topic/827488-15-character-hostname-limit-stillrecommended
- https://blog.sqlauthority.com/2017/04/18/sql-server-login-failed-login-untrusted-domain-cannot-used-windows-authentication/
- https://blog.sqlauthority.com/2012/09/06/sql-server-fix-error-cannot-connect-to-login-failedthe-login-is-from-an-untrusted-domain-and-cannot-be-used-with-windows-authenticationmicroso-sql-server-error-18452/
Thank you very much for the great article you have posted here.
If someone ever faced any issue while connecting to MSSQL Server in another domain using windows authentication, the Below article will help to resolve the problem as well.
https://techiewheel.blogspot.com/2020/12/connect-to-mssql-server-in-another.html
LikeLike