Is it possible to change the user account of the localdb instance in SQL Server?
Asked Answered
S

2

11

Is it possible to change the user account of the localdb instance in SQL Server? We changed our domain and it is using my old domain account so I can no longer login anymore. Also, I don't believe that you can login with SQL auth, so the sa account doesn't work, I tried that. I am using both SQL Server 2014 and 2016.

Scales answered 28/11, 2016 at 19:23 Comment(6)
If you can't login with SQL Auth or Domain account then there is no way to use it. The only way is to get someone that can get in with elevated privileges to create you a local SQL Auth account or hook you up with windows auth in the new domain.James
I found the fix, you need to go to C:\Users\UserName\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances and delete the instanceName folder, then in SSMS login to that instance (localdb)\instanceName and it will recreate that instanceName folder with the correct permissions. After that you need to just re-attach your databases from *C:\Users\UserName* and you are all set.Scales
@bkorzynski, you last comment helped me a lot! Thank you...Englert
@Englert awesome, glad I could be of assistanceScales
@Scales you should move this comment into an answer - this is the correct answer and should be accepted for visibility.Gathers
@Scales you should post the fix as an answer and accept it, to prevent fake answers. People with the same problem won't see your comment and may try a harmful answerRailing
J
0

If it is a local DB and you are totally locked out you will probably have to uninstall and reinstall. When you uninstall your data and log files should be left in the original location. After you reinstall you can Attach the files to the new instance of the server. If this is a machine used by everyone in the business someone should be able to login with elevated privileges and set you up with what you need.

Here is an example of how to reattach database files.

James answered 1/3, 2023 at 14:44 Comment(0)
P
-1

Directly changing the user account of a LocalDB instance in SQL Server to align with a new domain is not inherently simple due to LocalDB's reliance on Windows Authentication, excluding the use of SQL Server Authentication by default. This limitation renders the sa account unusable for access purposes. Nevertheless, there are practical measures you can undertake to recover access and possibly modify the Windows account linked to the LocalDB instance.

Pinkiepinkish answered 6/2 at 12:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.