如何使用自定义密码保护SqlLocalDB数据库文件 [英] How to protect SqlLocalDB database file with custom password

查看:265
本文介绍了如何使用自定义密码保护SqlLocalDB数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用SqlLocalDb v11.0实例设计了一个软件.该数据库将位于用户的计算机上(.mdf文件).我以前使用过SQL Server CE.

I have designed a software using SqlLocalDb v11.0 instance. The database will be on user's machine (.mdf file). I was using SQL Server CE before.

在SQL Server CE中,我的数据库受密码保护,密码为加密模式=引擎默认值"

In SQL Server CE my database is protected by a password with "Encryption Mode = Engine Default"

有什么方法可以保护SqlLocalDB吗?

Is there any way to protect SqlLocalDB?

我知道有一种使用命名实例的方法,如链接所示 https://msdn.microsoft.com/en -us/library/hh510202(v = sql.110).aspx

I know there is a way using named instances, as in the link https://msdn.microsoft.com/en-us/library/hh510202(v=sql.110).aspx

有什么方法可以将密码与LocalDB .mdf文件关联.这样其他任何人都无法打开它?

Is there any way to associate password with LocalDB .mdf file. So that any other can not open it?

推荐答案

如果您的意思是保护文件免受用户侵害,我认为答案是否定的,那就不能.用户可以简单地复制您的文件.

If you mean protecting files from user, I think the answer is No, you can't. a user can copy your files simply.

LocalDB始终在用户安全性上下文下运行;也就是说,LocalDB 切勿使用本地管理员组的凭据运行.这 表示 LocalDB实例使用的所有数据库文件都必须是 可以使用拥有用户的Windows帐户访问,而无需 考虑加入本地Administrators组的成员身份.

LocalDB always runs under the users security context; that is, LocalDB never runs with credentials from the local Administrator’s group. This means that all database files used by a LocalDB instance must be accessible using the owning user’s Windows account, without considering membership in the local Administrators group.

有关更多信息,请参见 SQL Server中的权限"部分. 2012 Express LocalDB

For more information see Permissions section in SQL Server 2012 Express LocalDB

我相信您可以选择使用.Net Framework和TSQL方法来加密和解密数据,但是您不能使用数据库加密选项来保护数据库对象,因为LocalDB不支持TDE(透明数据加密).

I believe you have the option to encrypt and decrypt data using .Net Framework and TSQL methods, but you can't protect your database objects using database encryption options since TDE (Transparent Data Encryption) is not supported by LocalDB.

这篇关于如何使用自定义密码保护SqlLocalDB数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆