MySQL 用户权限相关命令
##1、创建用户:
create user test identified by '123456';##identified后面跟密码
##2、查询所有用户:
select user from mysql.user;
##3、给用户添加所有权限:
#用户详情的权限列表请参考MySQL官网说明:http://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html
GRANT ALL ON shop.* TO 'test'@'%' WITH GRANT OPTION;#将“shop”换成“*”就相当于给用户在所有数据库中添加所有权限
##4、显示用户权限:
show grants for 'test'@'%';
##5、给用户添加指定的权限:
grant select,insert,update on shop.* to 'test'@'%';
#6.修改密码
desc mysql.user;
ALTER USER 'test'@'%' IDENTIFIED BY '12345678';
#7.移除用户某个权限:
revoke ALL on *.* from 'test'@'%';
##删除用户:
DROP USER test;##删除用户XIAO
commit;
flush privileges;
权限表