1

Yesterday, I switched from a domain user account to a local user account in Windows. Before the change, I could connect to my local database instance, but after leaving the domain, I cannot connect anymore. I get the message Cannot connect to <pcname>\<instance name>. (Error 18456).

Because the pc name was identical to my desired user name, I also renamed my pc. This could also be the problem.

Before the change, I connected to OLDPCNAME\INSTANCENAME. Now, I cannot connect to NEWPCNAME\INSTANCENAME.

Can anybody help me with connecting to my instance?

Aleksey Vitsko
  • 4,308
  • 3
  • 21
  • 47
Leonard
  • 11
  • 3
  • The above linked article goes into the details of getting back in to your SQL Server instance and adding a Windows Account/Login. Best of luck. – John K. N. Jul 02 '21 at 11:27
  • Your domain login is a different account from you local account. Did you create a new login within SQL Server and give it access to your databases? – AMtwo Jul 02 '21 at 12:14
  • First comment is your answer, single user mode access to SQL Server in order to add an account and give it sysadmin permissions. – Amine C Jul 02 '21 at 14:12

1 Answers1

0

You should be able to connect to your SQL Instance using "sa" sysadmin account (if you haven't turned off SQL authentication, and remember password from your "sa" account)

Also you can try to rename your PC back to OLDPCNAME and try to connect to it using windows authentication. If you can connect, then the problem was due to renaming PC.

Check out these links, how renaming PC affects SQL Instance:

https://docs.microsoft.com/en-us/sql/database-engine/install-windows/rename-a-computer-that-hosts-a-stand-alone-instance-of-sql-server?view=sql-server-ver15

https://docs.microsoft.com/en-us/sql/database-engine/install-windows/rename-a-computer-that-hosts-a-stand-alone-instance-of-sql-server?view=sql-server-ver15

If you still can't connect after renaming PC, then the problem must be because of switching from a domain user account to a local user account in Windows. Switch back to domain account, connect to SQL instance, and create a login for local user account in Windows, running below

create login "YourPCName\YourUserName" from Windows
Aleksey Vitsko
  • 4,308
  • 3
  • 21
  • 47