zoukankan      html  css  js  c++  java
  • mysql grant命令

    增删改查的权限
    grant select on testdb.* to common_user@'%' grant insert on testdb.* to common_user@'%' grant update on testdb.* to common_user@'%' grant delete on testdb.* to common_user@'%'
    grant select, insert, update, delete on testdb.* to common_user@'%'
    所有权限 其中,关键字 “privileges” 可以省略。 grant all privileges on database_name.* to user1@localhost identified by "000000";

    grant 高级 DBA 管理 MySQL 中所有数据库的权限。
    grant all on *.* to dba@'localhost'


    创建修改,删除表的权限
    grant create on testdb.* to developer@'192.168.0.%';
    grant alter on testdb.* to developer@'192.168.0.%';
    grant drop on testdb.* to developer@'192.168.0.%';

    外键操作权限
    grant references on testdb.* to developer@'192.168.0.%';

    临时表权限
    grant create temporary tables on testdb.* to developer@'192.168.0.%';

    索引权限
    grant index on testdb.* to developer@'192.168.0.%';

     grant 作用在存储过程、函数上:

      grant execute on procedure testdb.pr_add to 'dba'@'localhost'
      grant execute on function testdb.fn_add to 'dba'@'localhost'

    grant 作用在表中的列上
      grant select(id, se, rank) on testdb.apache_log to dba@localhost;
    grant作用的可分多个层次
      1.grant 整个 MySQL 服务器上
        grant select on *.* to dba@localhost; -- dba 可以查询 MySQL 中所有数据库中的表。
        grant all on *.* to dba@localhost; -- dba 可以管理 MySQL 中的所有数据库
      2.grant 单个库
        grant all    on test.* to dba@localhost;
      3.grant单个表
        grant all    on test.tb1 to dba@localhost;
      4.grant 多个列
        grant select(id,name) on test.tb1 to dba@localhost
      5.grant 存储过程、函数
        grant execute on procedure testdb.pr_add to 'dba'@'localhost'
        grant execute on function testdb.fn_add to 'dba'@'localhost'


      查看当前用户(自己)权限:

      show grants;

      查看其他 MySQL 用户权限:

      show grants for dba@localhost;

      撤销权限用revoke 把to换成from

  • 相关阅读:
    自定义ViewGroup基础巩固2---onMeasure()学习及综合实现圆形菜单
    Django自定义模板函数
    django迁移:全局、局部
    setup.py
    企鹅去北极熊家里玩
    python插入记录后获取最后一条数据的id
    清除浮动和解决塌陷
    html知识代码
    django模型:为已存在的表建立模型
    django模型:字段和选项
  • 原文地址:https://www.cnblogs.com/isuben/p/5506513.html
Copyright © 2011-2022 走看看