如何删除“服务器名称” SQL Server Management Studio 历史记录中的项目
当尝试连接到 Management Studio(特别是 2008)中的服务器时,有一个字段可供您输入服务器名称。 该字段还有一个下拉列表,其中显示您尝试连接的服务器的历史记录。
- 如何删除单个项目 从那段历史?
- 如何删除 登录字段历史记录中的项目 每个服务器名称?
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.
- How to remove an individual item
from that history? - How to remove an
item from the Login field history
for each Server name?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
在带有 SQL Express 2008 的 Windows Server 2008 标准中,“SqlStudio.bin”文件位于此处:
In Windows Server 2008 standard with SQL Express 2008, the "SqlStudio.bin" file lives here:
在 SSMS 2012 中,有一种记录在案的方法可以从“连接到服务器”对话框中删除服务器名称。 现在,我们可以通过在对话框中选择服务器名称并按 DELETE 来删除服务器名称。
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.
从以上路径删除文件:(删除前请关闭SSMS)
SQL Server 2005用户的文件位置路径,< /em>
SQL Server 2008 用户的文件位置路径,
注意: 格式名称已更改。
Server 2008 standard/SQL Express 2008 用户的文件位置路径
SQL Server 2012 用户的文件位置路径、
SQL 用户的文件位置路径Server 2014,
注意:在 SSMS 2012(
版本 10.50.1600.1 或以上
)中,您可以通过以下方式删除服务器名称:从下拉列表中选择它并按DELETE
。Delete the file from above path: (Before delete please close SSMS)
File location path for the users of SQL Server 2005,
File location path for the users of SQL Server 2008,
Note: Format Name has been changed.
File location path for the users of Server 2008 standard/SQL Express 2008
File location path for the users of SQL Server 2012,
File location path for the users of SQL Server 2014,
Note: In SSMS 2012 (
Version 10.50.1600.1 OR Above
), ow you can remove the server name by selecting it from dropdown and pressDELETE
.文件SqlStudio.bin实际上包含“Microsoft.SqlServer.Management.UserSettings.SqlStudio”类型的二进制序列化数据。
使用 BinaryFormatter 类,您可以编写简单的 .NET 应用程序来编辑文件内容。
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.
从命令提示符(开始\所有程序\附件\命令提示符):
From the Command Prompt (Start \ All Programs \ Accessories \ Command Prompt):
对于 Windows Vista 和 SQL Server 2005,
删除此文件,或使用记事本打开它,然后清除要从历史记录中清除的服务器名称
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
这是正确的做法
http://blogs.msdn.com/b/managingsql/archive/2011/07/13/deleting-old-server-names-from-quot-connect-to-server -quot-dialog-in-ssms.aspx
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
C:\Users\\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell
C:\Users\\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell
不要删除或重命名此文件:
Rather than deleting or renaming this file:
从 SQL Server 2012 开始,您不再需要经历删除 bin 文件的麻烦(这会导致其他副作用)。 您应该能够在
连接到服务器
对话框中的服务器名称:
下拉列表的MRU 列表中按删除键。 这记录在此连接项中 和 此博文。展开下拉列表后,将鼠标悬停在要删除的项目上,并突出显示该项目,在下拉列表仍处于展开状态时,按 Delete< /kbd> 键。 (如果您的键盘有两个这样的键,请使用不兼作 Backspace 的键,这在以 Mac 为中心的键盘中很常见。)下拉列表将立即重新绘制并删除选择:
请注意,如果单个服务器名称有多个条目(例如,一个具有 Windows 身份验证,一个具有 SQL 身份验证),您将无法辨别您是哪一个删除。 由于它是一个 MRU 列表,因此在您再次成功连接之前顺序不会改变,因此您可以通过选择您认为正确的项目来解决此问题,并检查选择后哪些凭据会弹出到对话框的其余部分。 当您确定要删除的条目后,请将鼠标悬停在扩展下拉列表中的该条目上并按删除重复上述过程>。
在旧版本中,您可以通过删除
SqlStudio.bin
或mru.dat
并让 SSMS 重新生成文件来删除整个列表,但这是一种暴力方法 - 不是它不仅删除了所有连接条目,而且还清除了其他设置。 为了更加手术,您必须弄清楚如何正确修改这些文件,这不是一件容易的任务(请参阅这个< /a> 和这个)。 在较新的版本中,您可以修改UserSettings.xml
- 它以更易于理解的形式存储这些设置。关闭 SSMS 的所有实例
导航到
%appdata%\Microsoft\SQL Server Management Studio
深入了解您想要影响的主要版本,例如
18.0
(您可能只有一个,或者您可能需要重复多个) - 而不是带有_IsoShell
后缀的文件夹制作
UserSettings.xml的备份副本
使用记事本打开
UserSettings.xml
查找您要查找的服务器条目
它可能是这样的单个条目,在这种情况下,您可以删除整个
节点:<块引用>
或者它可能是一个复合条目,您在其中以不同方式(不同的身份验证方法或不同的 SQL 身份验证用户名)连接到相同的服务器/实例名称。 在这种情况下,您需要(小心!)仅删除感兴趣的
。 对于 Windows 身份验证,它将如下所示,其中AuthenticationMode
将为0
:<块引用>
对于 SQL 身份验证,
AuthenticationMode
将为1
,您可以通过确定要删除的
:
<用户名><块引用>
保存
UserSettings.xml
并重新启动SSMSAs 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:
drop-down in theConnect to Server
dialog. This is documented in this Connect item and this blog post.With the drop-down expanded, hover over the item you want to remove, and with it highlighted while the drop-down is still expanded, press the Delete key. (If you have a keyboard with two such keys, use the one that doesn't double as Backspace, common with Mac-centric keyboards.) The drop-down list will redraw immediately and remove the selection:
Note that if you have multiple entries for a single server name (e.g. one with Windows Authentication and one with SQL Authentication), you won't be able to tell which one you're deleting. Since it is an MRU list, the order won't change until you make another successful connection, so you can solve this by selecting the item you think is the right one, and checking which credentials pop into the remainder of the dialog once selected. When you've identified the one to delete, then repeat the process above by hovering over that entry in the expanded drop-down list and pressing Delete.
In older versions you could delete the entire list by deleting
SqlStudio.bin
ormru.dat
and letting SSMS re-generate the file, but this was a brute force method - not only did it delete all connection entries, but it blew away other settings, too. To be more surgical, you'd have to figure out how to modify those files correctly, and this is not an easy task (see this and this). In newer versions, you can modifyUserSettings.xml
- which stores these settings in a much more human readable form.Close down all instances of SSMS
Navigate to
%appdata%\Microsoft\SQL Server Management Studio
Drill into the major version you want to impact, like
18.0
(you may only have one, or you may have to repeat for multiple) - and not the folder with the_IsoShell
suffixMake a backup copy of
UserSettings.xml
Open
UserSettings.xml
with notepadFind the server entry you're looking for
It may be a single entry like this, in which case, you can delete the entire
<Element>
node:Or it may be a compound entry, where you've connected to the same server/instance name in different ways (different authentication methods or different SQL Authentication usernames). In this case, you want to (carefully!) delete just the
<Item>
of interest. For Windows Authentication it will look like this, whereAuthenticationMode
will be0
:And for SQL Authentication,
AuthenticationMode
will be1
, and you can identify which<Item>
to remove by the<UserName>
:Save
UserSettings.xml
and restart SSMS这是从此列表中清除项目的最简单方法。
我们开始吧。
Here is the simplest way to clear items from this list.
there we go.
对于 SQL 2005,删除文件:
C:\Documents and Settings\\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat
对于 SQL 2008,文件位置、格式和名称已更改:
C:\Documents and Settings\\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin
如何清除列表:
此请求已在 Microsoft Connect 上注册
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:
This request is registered on Microsoft Connect
在这个重复的问题上,@arcticdev 发布了一些代码,这些代码将删除单个条目(而不是删除 bin 文件中的所有条目) )。
我将它包装在一个非常丑陋的用户界面中并将其放在这里: http://ssmsmru.codeplex.com/
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/
对于 SQL Server 2012 Management Studio,此文件已移动。 它现在位于:
For SQL Server 2012 Management Studio, this file has moved. It is now located at:
这是一个简单的方法。
打开连接窗口,单击服务器名称下拉列表,并将鼠标悬停在要删除的连接字符串上,然后按删除。
Here is an 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.