Fixing logins

I ran into an issue recently where I couldn’t get a Windows login to work with some application software. This software had been configured with a user account, which appeared to be in SQL Server, but it couldn’t connect.

It turned out that the local name of the workstation had changed. In this case, I’d renamed a Windows host in a VM, and my login was automatically renamed in Windows, but not in SQL Server.

A quick fix. In this case, I needed to just alter the computername in the login with this code:

ALTER LOGIN [WIN2016\fileshareuser]
WITH NAME=[SJ-DEMOSITC1\fileshareuser]

Once I did this, everything started working again.

It’s rare that we rename items, but it does happen, especially in lab environments. It’s good to know how to remap any of those principals that might be affected if it happens to you.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.