mysql-权限管理

查询用户:
    select User from user;
    
授权权限:
    授予指定权限:
    grant insert,select on *.* to 'user_name'@'localhost' with grant option; (*.*的意思:如:A.B => 数据库A中的表B)
    授予所有权限:
    grant all privileges on *.* to 'user_name'@'localhost' with grant option;
        
查看权限:
    show grants for 'user_name'@'localhost';
    查看当前用户的权限:show grants;
    
回收权限:
    回收指定权限:
    revoke insert,select,grant option on *.* from 'user_name'@'localhost' ...;
    回收所有权限:
    revoke all privileges,grant option from 'user'@'localhost' ...;
    
    
    grant insert,select on *.* to 'zhangsan'@'localhost' with grant option;
    show grants for 'zhangsan'@'localhost';

 

posted @ 2017-06-08 22:24  oural  阅读(143)  评论(0编辑  收藏  举报