限制 SQL Server 登录只能访问一个数据库
我有一个 SQL Server
服务器,上面有大约 50 个数据库。
我希望为希望访问其数据库的客户创建一个新的Login
。
但我不想让他们访问其他 49 个数据库。
我该怎么做?
I have a SQL Server
server which has around 50 databases on it.
I wish to create a new Login
for a client who wishes to have access to their database.
But I don't want to give them access to the other 49 databases.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为这是我们非常喜欢做的事情。
如果您之前已经创建了用户并分配给该数据库,
请通过执行以下操作将其删除并按照以下步骤
操作有关更多信息,请点击链接:
隐藏 Microsoft Sql Server 2008R2 及更高版本上的登录数据库
I think this is what we like to do very much.
If you already created a user and assigned to that database before by doing
then kindly delete it by doing below and follow the steps
For more information please follow the links:
Hiding databases for a login on Microsoft Sql Server 2008R2 and above
更新:
您还需要转到
安全 -> ;服务器角色
,对于公共
,检查TSQL默认TCP/TSQL默认VIA/TSQL本地计算机/TSQL命名管道
的权限并删除连接
权限UPDATE:
You'll also want to goto
Security -> Server Roles
, and forpublic
check the permissions forTSQL Default TCP/TSQL Default VIA/TSQL Local Machine/TSQL Named Pipes
and remove theconnect
permission这是为了补充被选为正确答案的内容。它缺少一个步骤,如果不完成,用户仍然可以访问数据库的其余部分。
首先,按照@DineshDB 的建议执行
以下缺少的步骤:
就是这样。
this is to topup to what was selected as the correct answer. It has one missing step that when not done, the user will still be able to access the rest of the database.
First, do as @DineshDB suggested
the missing step is below:
And thats it.
对于其他想知道如何执行此操作的人,我为 SQL Server 2008 R2 及更高版本提供了以下解决方案:
这将完全满足上述要求。
For anyone else out there wondering how to do this, I have the following solution for SQL Server 2008 R2 and later:
This will address exactly the requirement outlined above..