1,查看所有用户权限
select distinct concat('User:''',user,'''@''',host,''';') AS query from
mysql.user;
或者:
select * from mysql.user;
2,查看某一个用户的权限
show grants for 'user'@'ip';
3,分配权限(以selcet权限为例)
–无须密码
grant select on *.* to 'user'@'ip';
–指定密码(xxxx为密码)
grant select on *.* to 'user'@'ip'identified by 'xxxx';
4,回收权限
revoke select on *.* from 'user'@'ip'identified by 'xxxx';
–暴利删除某用户的所有权限
delete from mysql.user where User='user'
5,刷新权限,否则不生效
flushprivileges;
附,查看当前端口
show global variables like 'port';