• 实验四 数据库安全设计


    实验四 数据库安全设计

    数据库维护人员(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';
    
  • 相关阅读:
    MyBatis执行sql的整个流程
    Ftp传输:向linux服务器上传文件时“550 Permission denied.”错误问题解决
    SpringBoot框架:两个方法同时调用时父方法使内部方法的DataSource注解失效的解决办法
    SpringBoot框架:通过AOP和自定义注解完成druid连接池的动态数据源切换(三)
    SpringBoot框架:配置文件application.properties和application.yml的区别
    SpringBoot框架:'url' attribute is not specified and no embedded datasource could be configured问题处理
    bash脚本打印字符串一个空格的内容
    gethostbyname的线程安全
    算法工程师的职业规划
    理解Deep Link & URI Schemes & Universal Link & App Link
  • 原文地址:https://www.cnblogs.com/lightice/p/12732178.html
Copyright © 2020-2023  润新知