zoukankan      html  css  js  c++  java
  • PostgreSQL创建只读权限的用户

    1、创建只读角色

    CREATE ROLE readaccess;
    

    2、授予对现有表的访问权限

    GRANT USAGE ON SCHEMA public TO readaccess;
    GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
    

    3、授予后面新增表的访问权限

    ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
    

    4、创建用户

    CREATE USER tomek WITH PASSWORD 'mypassword';
    GRANT readaccess TO testuser;


    postgres数据库查看用户权限

    1、查看某用户的表权限

    1
    select * from information_schema.table_privileges where grantee='user_name';
     

    2、查看usage权限表

    1
    select * from information_schema.usage_privileges where grantee='user_name';
     

    3、查看存储过程函数相关权限表

    1
    select * from information_schema.routine_privileges where grantee='user_name';
     

    4、建用户授权

    1
    2
    3
    create user user_name;
    alter user user_namewith password '';
    alter user user_namewith CONNECTION LIMIT  20;#连接数限制
    没钱也要活的精彩
  • 相关阅读:
    修改boot.ini产生彩色的启动菜单
    五行山下的猴子
    一个中文输入的类
    黑洞
    驱动中 定时
    水煮TCPMP (转)
    OGame的建筑说明
    3D数学 矩阵的更多知识(1)
    OGame银河系说明
    七则很有启迪性的心理寓言【转】
  • 原文地址:https://www.cnblogs.com/telwanggs/p/14344591.html
Copyright © 2011-2022 走看看