如何从 SQL Server Management Studio 历史记录中删除“服务器名称”项目

2023-12-12

当尝试连接到 Management Studio(特别是 2008)中的服务器时,有一个字段可供您输入服务器名称。该字段还有一个下拉列表,其中显示您尝试连接的服务器的历史记录。

  1. 如何删除单个项目 从那段历史?
  2. 如何删除 登录字段历史记录中的项目 每个服务器名称?

从 SQL Server 2012 开始,您不再需要经历删除 bin 文件的麻烦(这会导致其他副作用)。您应该能够在 MRU 列表中按删除键Server name:下拉菜单中Connect to Server对话。这记录在此连接项目 and 这篇博文.

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:

Before & after removing entry from MRU list

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.

在旧版本中,您可以通过删除来删除整个列表SqlStudio.bin or mru.dat并让SSMS重新生成文件,但这是一种暴力方法 - 不仅删除了all连接条目,但它也破坏了其他设置。为了更加外科手术,您必须弄清楚如何正确修改这些文件,这不是一件容易的任务(请参阅this and this)。在较新的版本中,您可以修改UserSettings.xml- 以更易于理解的形式存储这些设置。

  1. 关闭 SSMS 的所有实例

  2. 导航%appdata%\Microsoft\SQL Server Management Studio

  3. 深入研究您想要影响的主要版本,例如18.0(您可能只有一个,或者您可能必须重复多个) - 而不是带有_IsoShell suffix

  4. 制作备份副本UserSettings.xml

  5. Open UserSettings.xml用记事本

  6. 找到您要查找的服务器条目

    它可能是这样的单个条目,在这种情况下,您可以删除整个条目<Element> node:

    Example single entry

    或者它可能是一个复合条目,您在其中以不同的方式(不同的身份验证方法或不同的 SQL 身份验证用户名)连接到相同的服务器/实例名称。在这种情况下,您要(小心!)仅删除<Item>出于兴趣。对于 Windows 身份验证,它看起来像这样,其中AuthenticationMode0:

    Windows Authentication MRU list item

    对于 SQL 身份验证,AuthenticationMode1,并且您可以识别哪个<Item>删除由<UserName>:

    SQL Authentication MRU list item

  7. Save UserSettings.xml并重新启动SSMS

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何从 SQL Server Management Studio 历史记录中删除“服务器名称”项目 的相关文章

随机推荐