224 sql-server security ssms login
我最近使用了我公司的备用笔记本电脑(一般用户设置),而我的维修工作正在进行中.登录数据库时,我检查了SQL Server Management Studio中的"记住密码"选项.
我需要清除我用来阻止下一个使用笔记本电脑的人使用我的登录名和密码的登录名和密码信息.我怎样才能做到这一点?
Rob*_*ten 318
此处的另一个答案还提到自2012年以来您可以通过如何从"连接到服务器"对话框中删除缓存的服务器名称来删除"删除缓存登录" ?.刚刚确认在MRU列表中的这个删除在2016年和2017年正常工作.
SQL Server Management Studio 2017删除该文件
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\14.0\SqlStudio.bin
SQL Server Management Studio 2016删除该文件
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\13.0\SqlStudio.bin
SQL Server Management Studio 2014删除该文件
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\12.0\SqlStudio.bin
SQL Server Management Studio 2012删除该文件
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\11.0\SqlStudio.bin
SQL Server Management Studio 2008删除该文件 C:\Users\%username%\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\SqlStudio.bin
SQL Server Management Studio 2005删除文件 - 与上面的答案相同,但Vista路径.
C:\Users\%username%\AppData\Roaming\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat
这些是Vista/7/8的配置文件路径.
编辑:
注意,AppData
是一个隐藏文件夹.您需要在资源管理器中显示隐藏的文件夹.
Edy*_*dyn 35
对于那些寻找SSMS 2012解决方案的人来说......看到这个答案:
实际上,在2012年,您可以从服务器列表下拉列表中删除服务器,该下拉列表清除该服务器的所有缓存登录.
Nei*_*eil 27
在我的场景中,我只想从列表中删除一个特定的用户名/密码,该列表中包含许多其他保存的连接,我不想忘记.事实证明,SqlStudio.bin
其他人在这里讨论的文件是类的.NET二进制序列化Microsoft.SqlServer.Management.UserSettings.SqlStudio
,可以对其进行反序列化,修改和重新序列化以修改特定设置.
为了完成特定登录的删除,我创建了一个新的C#.Net 4.6.1控制台应用程序并添加了对位于以下dll中的命名空间的引用:( C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Microsoft.SqlServer.Management.UserSettings.dll
根据SSMS版本,您的路径可能略有不同)
从那里我可以根据需要轻松创建和修改设置:
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Microsoft.SqlServer.Management.UserSettings;
class Program
{
static void Main(string[] args)
{
var settingsFile = new FileInfo(@"C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\13.0\SqlStudio.bin");
// Backup our original file just in case...
File.Copy(settingsFile.FullName, settingsFile.FullName + ".backup");
BinaryFormatter fmt = new BinaryFormatter();
SqlStudio settings = null;
using(var fs = settingsFile.Open(FileMode.Open))
{
settings = (SqlStudio)fmt.Deserialize(fs);
}
// The structure of server types / servers / connections requires us to loop
// through multiple nested collections to find the connection to be removed.
// We start here with the server types
var serverTypes = settings.SSMS.ConnectionOptions.ServerTypes;
foreach (var serverType in serverTypes)
{
foreach (var server in serverType.Value.Servers)
{
// Will store the connection for the provided server which should be removed
ServerConnectionSettings removeConn = null;
foreach (var conn in server.Connections)
{
if (conn.UserName == "adminUserThatShouldBeRemoved")
{
removeConn = conn;
break;
}
}
if (removeConn != null)
{
server.Connections.RemoveItem(removeConn);
}
}
}
using (var fs = settingsFile.Open(FileMode.Create))
{
fmt.Serialize(fs, settings);
}
}
}
Run Code Online (Sandbox Code Playgroud)
Kev*_*don 17
使用更新版本的 SQL Server Management Studio(我使用的是 18.4)有一种非常简单的方法可以做到这一点
登录不见了!不要乱用 dll 或 bin 文件。
作为gluecks指出,没有更多的SqlStudio.bin
在微软SQL Server Management Studio中18。我也发现了这个UserSettings.xml
在C:\Users\userName\AppData\Roaming\Microsoft\SQL Server Management Studio\18.0
。但是删除<Element>
包含凭据的内容似乎不起作用,如果我关闭并再次重新打开它,它会立即返回到 xml 文件中。
原来,您需要先关闭 SQL Server Management Studio,然后UserSettings.xml
在您喜欢的编辑器中编辑该文件,例如 Visual Studio Code。我猜除了这个 xml 文件之外,它还缓存在 SSMS 中的某个地方?!它没有打开Control Panel\All Control Panel Items\Credential Manager\Windows Credentials
。
对于 SQL Server Management Studio 2008
您需要转到C:\Documents and Settings\%username%\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell
删除SqlStudio.bin
小智 5
这适用于SQL Server Management Studio v18.0
文件“ SqlStudio.bin”似乎不再存在。相反,我的设置全部存储在此文件中:
C:\Users\*********\AppData\Roaming\Microsoft\SQL Server Management Studio\18.0\UserSettings.xml
<Element>.......</Element>
周围的整个块。从版本 18 或更高版本使用的 XML 文件中删除整个节点“元素”(在“连接”树中)。
C:\Users\%username%\AppData\Roaming\Microsoft\SQL Server Management Studio\18.0\UserSettings.xml
删除:
C:\Documents and Settings\%您的用户名%\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat”