Wednesday, April 18, 2012

Clearing remembered / default login for SQL Server Management Studio

By Steve Endow

Occasionally I have to test different SQL Server logins with varying permissions to troubleshoot random GP or integration errors.  Sometimes I test those logins by launching SQL Server Management studio and logging in to SQL to confirm they work and behave as expected.

Well, if you have ever tried this, you know that Management Studio suddenly falls in love with the last login that you used and will always display it as the default Login.


So, after I tested with a login of "testuser", every time I launched SQL Management Studio, I was prompted to login using "testuser", and had to always switch to the 'sa' login on my dev machine.  Seems trivial, but it's incredibly annoying, especially when you are just using to pressing enter to login as 'sa' with saved password.

I tried searching for this issue, but didn't get any relevant results.

Thanks to some help from a fellow expert on Experts Exchange, I was pointed to this Stack Overflow thread that explains how to delete the "remembered" logins for SQL Server Management Studio:

SQL Server Management Studio 2014 delete the file 
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\12.0\SqlStudio.bin
SQL Server Management Studio 2012 delete the file 
C:\Users\%username%\AppData\Roaming\Microsoft\Microsoft SQL Server Management Studio\11.0\SqlStudio.bin
SQL Server Management Studio 2008 delete the file
C:\Users\%username%\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

SQL Server Management Studio 2005 delete the file – same as above answer but the Vista path.
C:\Users\%username%\AppData\Roaming \Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat

Deleting the SqlStudio.bin file worked like a charm, and my 'testuser' is now nowhere to be found.

Just be aware that deleting the file will clear ALL saved server connections, logins, and saved passwords.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter



2 comments:

JediSQL said...

For Windows XP the path is C:\Documents and Settings\«username»\Application Data\Microsoft\Microsoft SQL Server\«VerNum»\Tools\Shell\SqlStudio.bin where VerNum is

90 for SQL 2005

100 for SQL 2008/2008 R2

Unknown said...

Dude, i don't know the english words to tell you how you make me happy ... Was looking for that trick for years ! Was getting really angry because first : the sa wasnt the first login selected, then when i select sa login, it always remembered the first password i typed for sa (which was wrong) so every single time i needed to execute some querry, i had to change the login, type our password of 20 char (1/3 i spell it wrong). Was really upset !

You made my day and the day of all my coworkers.

So a BIG THANK YOU !!