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

  • 相关阅读:
    arcsde 和oracle(双机热备)分布式安装(转载)
    ArcGIS Server分布式部署
    华为软件编程规范和范例(转载)
    常用Java开源库
    通过Word 2007发布Blog
    django中的models模块及数据库一些基本操作
    网页设计与后台程序解决方案模板引擎之Smarty
    Session 和 Cookie
    ul及li水平居中显示
    HTTP协议简介
  • 原文地址:https://www.cnblogs.com/isuben/p/5506513.html
Copyright © 2011-2022 走看看