Home > Database > Mysql Tutorial > body text

SQL 2012用户只能看到自己拥有权限的库

WBOY
Release: 2016-06-07 17:49:13
Original
1198 people have browsed it

SQL 2012用户只能看到自己拥有权限的库 呢,下面给大家参考参考。

以SQL Server 2012 为例

110336_8w02_99943[2]

上图是部分数据库的截图, 我们执行

Copy after login
Copy after login
Copy after login
 代码如下 复制代码
DENY VIEW any DATABASE to PUBLIC;
Copy after login
然后给Best库的Best用户执行

Copy after login
Copy after login
Copy after login
 代码如下 复制代码
ALTER AUTHORIZATION ON DATABASE::Best TO Best
Copy after login
H80O8P922`NXMA2FRC~60AH

资源管理器中Best用户登陆后就只能显示Best库了, 同样给Mine库的Mine用户执行相同SQL

Copy after login
Copy after login
Copy after login
 代码如下 复制代码
ALTER AUTHORIZATION ON DATABASE::Mine TO Mine
Copy after login
KM030PFB~D8GJO7R3CV%8YG

Mine用户登录后也只能显示Mine数据库了, 达到了咱的目的, 分配权限的时候记得给对应用户映射对应数据库的权限, 防止跨库操作.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template