create user [user] for login [login]  --建用户create schema [schema] authorization  [user]  --建架构再创建一个表  create table [schema].tb(col int)
然后用新建的 user 用户  登陆  却能对里面的表  [schema].tb 作任何操作 我明明没有 授权给 [user] 用户 在数据库内操作的权限啊  为什么还有 如何去掉[user]用户的 drop table alter table 之类的权限啊  

解决方案 »

  1.   

    授权:
    grant object_privilege | all
    on schema.object
    to user | role | public
    [with grant option]
    --object_privilege:对象权限,包括:alter,delete,execute,index,insert,select,update,trigger......
    --all:所有的权限
    --on:表示授权的数据库对象名,如表明,视图名
    --to:指明授权的用户和角色
    --public:表示授权给所有用户
    --[with grant option]:表示该用户有再将它拥有的权限授予其它用户或者角色的权利
    比如:
    将学生信息表的创建者所拥有的select,insert,update权限授予给user1
    grant select,insert,update
    on student
    to user1
    with grant option
    --撤销权限
    revoke [grant option for] object_privilege | all
    on schema.object
    from user | role | public
    restuict | cascade
    --grant option for:只有在grant语句中使用了with grant option语句,此句才起作用
    --all:表示系统将撤销对象上的所有设这权限
    --on:表示撤销权限的数据库对象名,如表明,视图名
    --from:指明撤销权限的用户或者角色
    --public:撤销数据库中所有用户的权限
    --restuict:假设该权限已经被用户传递给了其它用户,则这个权限将不会被取消
    --cascade: 假设该权限已经被用户传递给了其它用户,则这个权限被取消,同时由该用户传递给其它用户的该权限也被取消
    例如:
    用户user1对学生信息表的update权限被取消,用户此时值具对该表的select和insert两个权限
    revoke update
    on student
    from user1
    cascade