-- 查询账号主机,账号名,及加密插件
select host,user,plugin from mysql.user;
-- 增加用户
create user aa identified with caching_sha2_password by '123';
create user user1@'192.168.21.93' identified with caching_sha2_password by '123';
-- 删除用户
drop user aa;
-- 授权所有库所有表的操作
grant all on . to aa;
grant all on emp.emp to aa;
grant select on emp.emp to aa;
-- 设置密码
set password for aa ='';
-- 修改用户加密方式及密码 过期时间
alter user aa identified with mysql_native_password by '000' password expire interval 1 day;
-- 收回所有权限
revoke all on . from aa;
revoke select on * from aa@'%';
revoke all on emp.emp from aa;
revoke select on emp.emp from aa;
-- 查询所有权限
show grants for aa;