增删改查的权限
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. 关于linux多线程fork的理解和学习

    fork在英文中是"分叉"的意思.为什么取这个名字呢?因为一个进程在运行中,如果使用了fork函数,就产生了另一个进程,于是进程就"分叉"了,所以这个名字取得很 ...

  2. MySQL执行计划explain

    一.简介 分析查询慢的原因,在查询语句前加explain即可.如: 二.输出格式 2.0 测试数据 # 表user_info CREATE TABLE `user_info` ( `id` bigin ...

  3. CentOS 7.9 安装 zookeeper-3.7.0

    1. 下载 Zookeeper Zookeeper 官网 使用 wget 下载: wget https://mirrors.bfsu.edu.cn/apache/zookeeper/zookeeper ...

  4. jQuery基础入门+购物车案例详解

    jQuery是一个快速.简洁的JavaScript代码库(或JavaScript框架).jQuery设计的宗旨是"write Less,Do More",即倡导写更少的代码,做更多 ...

  5. 第06组 Beta冲刺 (2/5)

    目录 1.1 基本情况 1.2 冲刺概况汇报 1.郝雷明 2. 方梓涵 3.杜筱 4.黄少丹 5. 董翔云 6.鲍凌函 7.詹鑫冰 8.曹兰英 9.曾丽莉 10.吴沅静 1.3 冲刺成果展示 1.1 ...

  6. SSH 的使用和配置

    命令 ssh user@hostname -p port Windows 下首次执行这个命令会由于 Windows 默认没有运行 ssh-agent 导致无法连接,可以通过在 powershell 下 ...

  7. centos6搭建mysql

    目前CentOS6.5及一下版本基本上被官方给放弃更新了,但是考虑到忠实粉丝迟迟不肯放手,所以还留了入口但是非常有限 1.搭建mysql 可参照:https://blog.csdn.net/huang ...

  8. torch.cat()和torch.stack()

    torch.cat() 和 torch.stack()略有不同torch.cat(tensors,dim=0,out=None)→ Tensortorch.cat()对tensors沿指定维度拼接,但 ...

  9. 写Selenium代码时一些技巧

    本文地址: https://www.cnblogs.com/hchengmx/p/10880002.html 1. Chrome插件之"CSS Selector Helper for Chr ...

  10. .NET中如何在同步代码块中调用异步方法

    更新记录 本文迁移自Panda666原博客,原发布时间:2021年7月2日. 在同步代码块中调用异步方法,方法有很多. 一.对于有返回值的Task 在同步代码块中直接访问 Task 的 Result ...