增删改查的权限
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

mysql grant命令的更多相关文章

  1. MySQL grant命令使用

    MySQL 赋予用户权限命令的简单格式可概括为: grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删除 数据库中所有表数据的权利. grant sele ...

  2. mysql grant命令错误:ERROR 1044 (42000): Access denied for 'root' With All Privileges

    http://stackoverflow.com/questions/21714869/error-1044-42000-access-denied-for-root-with-all-privile ...

  3. MySQL的Grant命令[转]

    本文实例,运行于 MySQL 5.0 及以上版本. MySQL 赋予用户权限命令的简单格式可概括为: grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删 ...

  4. [MySQL] - MySQL的Grant命令

    本文实例,运行于 MySQL 5.0 及以上版本. MySQL 赋予用户权限命令的简单格式可概括为: grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删 ...

  5. MySQL的Grant命令

    来源:http://yingxiong.javaeye.com/blog/451208   本文实例,运行于 MySQL 5.0 及以上版本. MySQL 赋予用户权限命令的简单格式可概括为: gra ...

  6. MySQL授权命令grant的使用方法

    本文实例,运行于 MySQL 5.0 及以上版本. MySQL 赋予用户权限命令的简单格式可概括为: grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删 ...

  7. mysql 权限管理 grant 命令

    只有root账号可以授权,其他账号不能用grant 授权 mysql> select user(); +----------------+ | user() | +--------------- ...

  8. (转)MySQL的Grant命令

    [MySQL] - MySQL的Grant命令 来源:http://yingxiong.javaeye.com/blog/451208 本文实例,运行于 MySQL 5.0 及以上版本. MySQL ...

  9. MySQL授权命令grant的详细使用方法

    2019-01-07 转自 https://www.cnblogs.com/crxis/p/7044582.html 本文实例,运行于 MySQL 5.0 及以上版本. MySQL 赋予用户权限命令的 ...

随机推荐

  1. .Net 在容器中操作宿主机

    方案描述 在 docker 容器中想操作宿主机,一般会使用 ssh 的方式,然后 .Net 通过执行远程 ssh 指令来操作宿主机.本文将使用 交互式 .Net 容器版 中提供的镜像演示 .Net 在 ...

  2. 认识并安装WSL

    认识并安装WSL(基于Windows的Linux子系统) 什么是WSL WSL(Windows Subsystem for Linux),这是在windows平台运行的linux子系统.也就是说可是不 ...

  3. arts-week13

    Algorithm 992. Sort Array By Parity II - LeetCode Review https://tls.ulfheim.net/ HTTP协议图解 Tip linux ...

  4. 『忘了再学』Shell基础 — 17、预定义变量

    目录 1.预定义变量$? 2.预定义变量$$和$! 我们之前说过,Shell中的变量不是按照变量值的类型来进行分类的,而是按照Linux系统中定义的变量类别来分类的. 预定义变量就是,事先把变量的名称 ...

  5. Flink整合面向用户的数据流SDKs/API(Flink关于弃用Dataset API的论述)

    动机 Flink提供了三种主要的sdk/API来编写程序:Table API/SQL.DataStream API和DataSet API.我们认为这个API太多了,建议弃用DataSet API,而 ...

  6. 『忘了再学』Shell基础 — 26、cut列提取命令

    目录 1.cut命令说明 2.cut命令练习 (1)cut命令基本用法 (2)cut命令选取多列 (3)按字符来进行提取 (4)按指定分隔符进行截取数据 3.cut命令分隔符说明 1.cut命令说明 ...

  7. .NET中测试代码运行时间

    更新记录 本文迁移自Panda666原博客,原发布时间:2021年6月29日. 计算代码运行的时间,除了呆萌地用秒表去计时,或者可以通过Visual Studio来查看,还可以在.NET代码中使用St ...

  8. 1.2 操作系统的第二个功能——并发功能 -《zobolの操作系统学习札记》

    1.2 操作系统的第二个功能--并发功能 目录 1.2 操作系统的第二个功能--并发功能 问1:什么是并发功能?并发功能是必要的吗? 问2:并发功能必须要求拥有多核CPU吗? 问3:多核CPU和单核C ...

  9. ruoyi接口权限校验

    此文章属于ruoyi项目实战系列 ruoyi系统在前端主要通过权限字符包含与否来动态显示目录和按钮.为了防止通过http请求绕过权限限制,后端接口也需要进行相关权限设计. @PreAuthorize使 ...

  10. 送分题,ArrayList 的扩容机制了解吗?

    1. ArrayList 了解过吗?它是啥?有啥用? 众所周知,Java 集合框架拥有两大接口 Collection 和 Map,其中,Collection 麾下三生子 List.Set 和 Queu ...