How to remove “Server name” items from history of SQL Server Management Studio

荒凉一梦 提交于 2019-11-26 12:20:39

问题


When trying to connect to a server in Management Studio (specifically 2008), there is a field where you enter the Server name. That field also has a drop-down list where it shows a history of servers that you have attempted to connect to.

I would like to know:

  1. How to remove an individual item from that history.
  2. How to remove an item from the Login field history for each Server name.

Thanks!


回答1:


As of SQL Server 2012 you no longer have to go through the hassle of deleting the bin file (which causes other side effects). You should be able to press the delete key within the MRU list of the Server Name dropdown in the Connect to Server dialog. This is documented in this Connect item and this blog post.

Note that if you have multiple entries for a single server name (e.g. one with Windows and one with SQL Auth), you won't be able to tell which one you're deleting.




回答2:


For SQL 2005, delete the file:

C:\Documents and Settings\<USER>\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat

For SQL 2008, the file location, format and name changed:

C:\Documents and Settings\<USER>\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

How to clear the list:

  1. Shut down all instances of SSMS
  2. Delete/Rename the file
  3. Open SSMS

This request is registered on Microsoft Connect




回答3:


Here is simpliest way to clear items from this list.

  1. Open the Microsoft SQL Server Management Studio (SSMS) version you want to affect.
  2. Open the Connect to Server dialog (File->Connect Object Explorer, Object Explorer-> Connect-> Database Engine, etc).
  3. Click on the Server Name field drop down list’s down arrow.
  4. Hover over the items you want to remove.
  5. Press the delete (DEL) key on your keyboard.

there we go.




回答4:


Over on this duplicate question @arcticdev posted some code that will get rid of individual entries (as opposed to all entries being delete the bin file). I have wrapped it in a very ugly UI and put it here: http://ssmsmru.codeplex.com/




回答5:


For SQL Server 2012 Management Studio, this file has moved. It is now located at:

C:\Users\<username>\AppData\Roaming\Microsoft\
    SQL Server Management Studio\11.0\SqlStudio.bin



回答6:


In Windows Server 2008 standard with SQL Express 2008, the "SqlStudio.bin" file lives here:

%UserProfile%\Microsoft\Microsoft SQL Server\100\Tools\Shell\



回答7:


Delete the file from above path: (Before delete please close SSMS)

File location path for the users of SQL Server 2005,

C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat

File location path for the users of SQL Server 2008,

Note: Format Name has been changed.

C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

File location path for the users of Server 2008 standard/SQL Express 2008

C:\Documents and Settings\%USERNAME%\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin

File location path for the users of SQL Server 2012,

C:\Users\%USERNAME%\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\SqlStudio.bin

File location path for the users of SQL Server 2014,

C:\Users\%USERNAME%\AppData\Roaming\Microsoft\SQL Server Management Studio\12.0\SqlStudio.bin

Note: In SSMS 2012 (Version 10.50.1600.1 OR Above), ow you can remove the server name by selecting it from dropdown and press DELETE.




回答8:


In SSMS 2012 there is a documented way to delete the server name from the "Connect to Server" dialog. Now, we can remove the server name by selecting it in the dialog and pressing DELETE.




回答9:


File SqlStudio.bin actually contains binary serialized data of type "Microsoft.SqlServer.Management.UserSettings.SqlStudio".

Using BinaryFormatter class you can write simple .NET application in order to edit file content.




回答10:


From the Command Prompt (Start \ All Programs \ Accessories \ Command Prompt):

DEL /S SqlStudio.bin



回答11:


This is the correct way of doing it http://blogs.msdn.com/b/managingsql/archive/2011/07/13/deleting-old-server-names-from-quot-connect-to-server-quot-dialog-in-ssms.aspx




回答12:


Here is the easy way, open the connection window, click on the Server name dropdown and hover over the connection string you want to delete, then press delete.




回答13:


For Windows Vista and SQL Server 2005,

Delete this file, or open it with the Notepad and clear the server names that you want Clear from the history

%UserProfile%\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat



回答14:


C:\Users\\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell




回答15:


Rather than deleting or renaming this file:
1)Close SQL Management Studio
2)Find the appropriate file(see post or responses above)
3)Open the .bin in a text/hex editior like NotePad++
4)Search for the name of one of the servers and identify the line number
5)Make a copy of the .bin/.dat file
6)Delete that line, make sure you delete the entire line, its possible if you have many the line could wrap.
7)Open SQL Management Studio your dropdown will be blank



来源:https://stackoverflow.com/questions/1059105/how-to-remove-server-name-items-from-history-of-sql-server-management-studio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!