增删改查的权限
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. 用crash tool观察ARM64 Linux地址转换

    初学者学习Linux系统地址转换时,如果只是学习理论,又或者研读代码,那可能感觉比较枯燥.此时如果可以利用某些工具实际观察一下地址转换的过程,那可能会给枯燥的内核学习带来些微的乐趣.crash too ...

  2. windows 10 21H1 顶部任务栏点击音量或其他图标不出弹框

    右键任务栏,按照图片中描述操作

  3. 监控工具:nmon

    软件介绍 分析工具 分析 AIX 和 Linux 性能的免费工具,   这个高效的工具可以工作于任何哑屏幕.telnet 会话.甚至拨号线路.另外,它并不会消耗大量的 CPU 周期,通常低于百分之二. ...

  4. Python实现将excel文件转化为html文件

    需要转化的excel文件(nsrxx.xlsx): 源代码: import pandas as pdimport codecspd.set_option('display.width', 1000)p ...

  5. 【爬虫+情感判定+Top10高频词+词云图】"王心凌"热门弹幕python舆情分析

    目录 一.背景介绍 二.代码讲解-爬虫部分 2.1 分析弹幕接口 2.2 讲解爬虫代码 三.代码讲解-情感分析部分 3.1 整体思路 3.2 情感分析打标 3.3 统计top10高频词 3.4 绘制词 ...

  6. NodeJS全栈开发利器:CabloyJS究竟是什么

    CabloyJS CabloyJS是一款顶级NodeJS全栈业务开发框架, 基于KoaJS + EggJS + VueJS + Framework7 文档 官网 && 文档 演示 PC ...

  7. AtCoder ABC 250 总结

    AtCoder ABC 250 总结 总体 连续若干次一样的结果:30min 切前 4 题,剩下卡在 T5 这几次卡在 T5 都是一次比一次接近, 什么 dp 前缀和打挂,精度被卡,能水过的题连水法都 ...

  8. Node.js精进(1)——模块化

    模块化是一种将软件功能抽离成独立.可交互的软件设计技术,能促进大型应用程序和系统的构建. Node.js内置了两种模块系统,分别是默认的CommonJS模块和浏览器所支持的ECMAScript模块. ...

  9. ACL权限控制

    ALC讲述比较详细 https://zhuanlan.zhihu.com/p/360158311

  10. 基于SqlSugar的开发框架循序渐进介绍(9)-- 结合Winform控件实现字段的权限控制

    字段的权限控制,一般就是控制对应角色人员对某个业务对象的一些敏感字段的可访问性:包括可见.可编辑性等处理.本篇随笔结合基于SqlSugar的开发框架进行的字段控制管理介绍. 在设计字段权限的时候,我们 ...