Microsoft SQL management studio(latest version) can not be connnected by server name

Jesse Zhou 11 Reputation points
2021-09-28T02:26:12.057+00:00

Hello, ssms can connect to SQL server by IP address witout issues. But it can not connenct by server name,
The error is "The target principal name is incorrect. Cannot generate SSPI context." I don't change the password and other things.

I ping and nslookup the server name , get the correct information.

SQL Server | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Ronen Ariely 15,206 Reputation points
    2021-09-28T04:33:10+00:00

    Good day,

    This article will surely help you: http://support.microsoft.com/kb/811889

    Another long discussion with some insights can be found here: https://stackoverflow.com/questions/32309922/the-target-principal-name-is-incorrect-cannot-generate-sspi-context

    Note that if you are using Windows Authentication then try to switch to SQL Server Authentication can also bypass this type of issue.


  2. YufeiShao-msft 7,146 Reputation points
    2021-09-28T06:26:23.14+00:00

    Hi @Jesse Zhou ,

    This is a typical Kerberos authentication failure, the most common reason for this error is the SPN problem.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/4a811b0b-223f-4e08-9a7a-ba6d65b43663/the-target-principal-name-is-incorrect-cannot-generate-sspi-context-windows-authentication-sql

    1.Make sure TCP/IP Protocols are enabled and configured correctly;
    2.Close the firewall;
    3. In your DC, run->”adsiedit.msc”
    4.Assume that the start account is YX\Administrator, Administrator->Properties->Security->Advanced->Permissions->Add->Select a principle->Input “SELF”->OK (as next screenshot shows)
    5.Choose “Read serverPrincipalName” and “Write serverPrincipalName” (as next screenshot shows)
    6.Use this account restart your server and browser;

    You can refer to:
    https://support.microsoft.com/en-us/topic/how-to-troubleshoot-the-cannot-generate-sspi-context-error-message-03d15ff2-e062-e023-272c-d5cd413c37b3


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.