zoukankan      html  css  js  c++  java
  • 实验四 数据库安全设计

    实验四 数据库安全设计

    数据库维护人员(1人):可对订单数据库进行任何操作。
    账号名称:system_dbowner,密码为usercode1,允许任何ip通过此用户连接数据库

    all为所有权限

    订单数据库.*表示订单数据中的所有表

    system_dbowner 为用户名

    %表示所有ip地址

    usercode1为密码

    这句grant命令执行后如果数据库中没有对应的角色会自动创建

    grant all on 订单数据库.* to 'system_dbowner'@'%' identified by 'usercode1';
    
    数据录入人员(2人):可对订单数据库中所有表进行插入、删除、更新操作,
    (注意:为了顺利进行删除更新操作,也需要能有查询权限)
    不能创建与修改表结构及其它授权等操作。
    账号名称:datarecorder1, datarecorder2,密码为usercode1,允许任何ip通过此用户连接数据库
    grant select,insert,update,delete on 订单数据库.* to 'datarecorder1'@'%' identified by 'usercode1';
    grant select,insert,update,delete on 订单数据库.* to 'datarecorder2'@'%' identified by 'usercode1';
    
    订单管理人员(2人):能对订单数据库中的订单表和订货项目表进行插入、删除、更新操作,
    其它表仅能查询(注意:为了顺利进行删除更新操作,订单表和订货项目表也需要能有查询权限)。
    不能创建与修改表结构及其它授权等操作。
    账号名称:order_1,order_2,密码为usercode1,允许任何ip通过此用户连接数据库
    --授予订单数据库所有表的查询权限
    grant select on 订单数据库.* to 'order_1'@'%' identified by 'usercode1';
    grant select on 订单数据库.* to 'order_2'@'%' identified by 'usercode1';
    -- 授予订单数据库订单表和订货项目表的增删改权限
    grant insert,update,delete on 订单数据库.订单 to 'order_1'@'%' identified by 'usercode1';
    grant insert,update,delete on 订单数据库.订单 to 'order_2'@'%' identified by 'usercode1';
    grant insert,update,delete on 订单数据库.订货项目 to 'order_1'@'%' identified by 'usercode1';
    grant insert,update,delete on 订单数据库.订货项目 to 'order_2'@'%' identified by 'usercode1';
    
    客户管理人员(2人):能对订单数据库中的代理商表和客户表进行插入、删除、更新,
    其它表仅能查询(注意:为了顺利进行删除更新操作,代理商表和客户表也需要能有查询权限)。
    不能创建与修改表结构及其它授权等操作。
    账号名称:customer_1, customer_2,密码为usercode1,允许任何ip通过此用户连接数据库
    -- 赋予登陆权限
    grant usage on *.* to 'customer_2'@'%' identified by 'usercode1';
    grant usage on *.* to 'customer_1'@'%' identified by 'usercode1';
    -- 赋予对订单数据库查询权限
    grant select on 订单数据库.* to 'customer_2'@'%' identified by 'usercode1';
    grant select on 订单数据库.* to 'customer_1'@'%' identified by 'usercode1';
    -- 赋予对代理商和客户表的增删改权限
    grant insert,update,delete on 订单数据库.客户 to 'customer_2'@'%' identified by 'usercode1';
    grant insert,update,delete on 订单数据库.客户 to 'customer_1'@'%' identified by 'usercode1';
    grant insert,update,delete on 订单数据库.代理商 to 'customer_2'@'%' identified by 'usercode1';
    grant insert,update,delete on 订单数据库.代理商 to 'customer_1'@'%' identified by 'usercode1';
    
  • 相关阅读:
    【转】什么时候用抽象类,什么时候用接口
    高内聚松耦合在程序设计中如何做到
    如何做高水平的程序项目设计者
    NHibernate条件查询(Criteria Query)
    Oracle学习笔记之表结构修改
    Java集合类和HashMap遍历
    Asp.net中基于Forms验证的角色验证授权
    Springconfig.xml数据库操作Bean配置
    Java 常用排序算法实现快速排序、插入排序、选择、冒泡
    .net消息队列
  • 原文地址:https://www.cnblogs.com/lightice/p/12732178.html
Copyright © 2011-2022 走看看