zoukankan      html  css  js  c++  java
  • mysql权限回收测试

    测试mysql 权限

    准备三台虚拟机
    203.66 是mysql-server
    203.67 mysql-client
    203.68 mysql-client

    首先赋予全部库,全部权限

    grant all privileges on . to 'root'@'%' identified by '123456';

    1、创建三个数据库
    test2
    chao
    yuanting

    导入数据

    2、给所以库全部权限
    测试203.66 和 203.67 、203.68 是否可以删掉库,查询等。(是可以删除的)
    use test2;drop table manager_profile_photo;

    use test2;drop table manager_profile_photo;

    use test2;drop table manager_profile_photo;
    3、针对203.67 对 chao 读写权限 test2 读权限
    针对203.68 对 yuanting 读写权限 test2 读权限

    grant select,insert on chao.* to 'root'@'192.168.203.67' identified by '123456';

    grant select,insert,update,delete on yuanting.* to 'root'@'192.168.203.68' identified by '123456';

    grant select on test2.* to 'root'@'192.168.203.%' identified by '123456';

    flush privileges;

    测试203.66 和 203.67 、203.68 是否可以删掉库,查询等。

    4、赋予全部查询权限,针对203.67 对 test_67 读写权限 , 其他库读权限
    赋予全部查询权限,针对203.68 对 test_68 读写权限 , 其他库读权限

    5、回收权限all 权限
    revoke all privileges on . from 'root'@'%';

    grant select on . to 'root'@'%' identified by '123456';

    6、删除所有的表
    SELECT CONCAT('DROP TABLE ', table_name,';') FROM information_schema.TABLES WHERE table_schema='数据库名';

    7、清空表数据
    truncate table d_flow_log

    truncate table d_warning_history

  • 相关阅读:
    HBase权威指南
    Mapreduce编程
    Hive内部表和外部表的区别
    Android Volley全然解析(四),带你从源代码的角度理解Volley
    codeforces 448CPainting Fence
    2.maven 安装配置
    cocos2d-x 3.0正式版创建project笔记
    C. DZY Loves Sequences
    spring 基础回想 tips01
    spring 配置属性细节
  • 原文地址:https://www.cnblogs.com/sxgaofeng/p/12307263.html
Copyright © 2011-2022 走看看