Search code examples
sql-server

Error: "The target principal name is incorrect" when attempting to connect to SQL Server


I have a Windows 2012 Server which runs SQL Server and I connect to that SQL Server remotely over a VPN from my Windows 10 Laptop using SSMS. Recently, I had to replace the hard drive on the laptop and I did not completely copy over all my configurations, and I am now getting the error: "The target principal name is incorrect. Cannot generate SSPI context. (.Net SqlClient Data Provider)"

When I google around, people say to create an SPN or to run the Kerberos Configuration Manager, but I'm not using Kerberos. Other articles mention Active Directory but I'm not using Active Directory, and my laptop is set up as a Workstation, not in a domain.

I had this working before, and I did set up a Windows Credential in my user on the laptop to connect to the SQL Server with the correct domain, username, and password.

I already tried the easy things: IP address is set up correctly in laptop hosts file, rebooted both server and desktop, password is set to not expire on the server.


Solution

  • Go to Control Panel --> Users Account --> Windows Credentials.

    Make sure you have added the host name / ip address to your hosts file.

    Add a new Windows Credential. For the Internet or network adddress, use the host name that you put into your hosts file, but also append the sql server port number to the end with a colon in between (usually, this is :1433).

    For the Username, prepend the username with the domain name or the workgroup. In my case, it was a workgroup.

    Finally, enter the password associated with the username.