13

Some time ago I created a new login to my local SQL Server 2008 Express database server, called "sa_readonly". Now everytime I start SQL Server Management Studio, it displays the "Connect to Server" form, with the default login set to "sa_readonly". This login doesn't exist anymore, and I want to change the default login to "sa". How do i do that?

George
  • 1,111
  • 3
  • 20
  • 38
  • 1
    I found a solution here, however it is a bit drastic: [Removing the remembered login and password list in SQL Management Studio][1] [1]: http://stackoverflow.com/q/349668/91511 – George Feb 24 '12 at 12:50
  • 1
    There's a slightly-less-drastic option: delete your stored creds for a specific server (http://stackoverflow.com/a/10996066/565869). –  Feb 12 '15 at 15:43

3 Answers3

6

For SQL Server Management Studio 15.0.18330.0 (aka v. 18.5):

  1. Go to C:\Users[YOURNAMEHERE]\AppData\Roaming\Microsoft\SQL Server Management Studio\18.0
  2. Open the UserSettings.xml in your favorite text editor
  3. Search for the username you want to get rid of. You'll find it between an opening and closing UserName tag (e.g. < UserName >USERNAMEYOUWANTTODELETE< / UserName >). That tag will be inside a ServerConnectionSettings tag, which will be inside of an Item tag, inside an Element tag, inside of a Connections tag, inside of a ServerConnectionItem tag (so, ServerConnectionItem > Connections > Element > Item > ServerConnectionSettings > UserName)
  4. Delete the entire Element tag that contains the Username tag for the username you want to get rid of. Note that there are Element tags at higher and lower levels than the one you want to delete. Don't just delete the first Element tag you find. Delete the specific one that contains the Item tag which contains the ServerConnectionSettings tag which contains the UserName tag that you want to delete.
  5. Save the UserSettings.xml file

You're done. That user profile should be toast. Unless you had SSMS open while you did it, in which case the UserSettings.xml will be regenerated to what it was when you opened SSMS, and you'll have to do it all over again. Close SSMS first!

bryc3monk3y
  • 424
  • 8
  • 12
  • I was looking for a way to change order of logins, but reordering xml Elements in that file doesn't work. I had to remove all logins and add them in correct order. PS. You can replace path to AppData folder with %APPDATA% – Ila Jul 23 '20 at 19:23
5

From Removing the remembered login and password list in SQL Server Management Studio:

You can delete all remembered links by deleting or renaming a file.

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

These are the names for Vista/Win7

Community
  • 1
  • 1
Ken Mc
  • 1,268
  • 15
  • 12
4

You can simply highlight the server name and click DEL on keyboard, same thing for the logins

enter image description here

Max
  • 6,821
  • 3
  • 43
  • 59