mysql简单的权限操做

新建用户

CREATE USER 'test22'@'%' IDENTIFIED BY '1234';

权限操做

语法:数据库

grant all on db_name.table_name to 'user_name'@'host_name';
  1. grant 为授予 revoke 为撤销
  2. all 表明权限 有 select,insert,update,drop
  3. db_name.table_name :数据库名.表名,能够为*.*
  4. 'user_name'@'host_name':用户名@能够容许使用的ip
  5. 赋予权限通常是 命令 权限 on 数据库 to 用户
  6. 删除权限通常是 命令 权限 on 数据库 from 用户

  • 全部权限
    grant all ievent.* to 'user'@'%'

  • 撤销全部权限
revoke all ievent.*  from 'user'@'%'

  • 授予用户某个表权限
grant ievent.a_test on 'test2'@'%'

  • 撤销某个表权限
revoke all on ievent.a_test from 'test2'@'%'

  • 授予某些表的操做权限
grant select,insert,update on ievetn.a_test to 'test2'@'%'

查看用户权限

show grants for 'test2'@'%'
GRANT USAGE ON *.* TO `test2`@`%`;标示没有特殊权限
相关文章
相关标签/搜索