--- 查询用户、地址以及密码
SELECT User, Host, Password FROM mysql.user;
---- 删除zhang用户。地址为10.105.0网段
drop user 'zhang'@'10.105.0.%';
---- 刷新生效
flush privileges;
---- 查看用户授权表
show grants for 'zhang'@'10.105.0.%';
---- 创建用户
create user 'zhang'@'10.105.0.%' identified BY '123456' ;
---- 授权赋权
GRANT drop ON *.* TO 'zhang'@'10.105.0.%';
---- 撤销赋权,注意对于数据库的指定,要一致
revoke all on *.* from 'zhang'@'10.105.0.%';
---- 赋权与撤销一致
grant all privileges on 'test'.* to 'zhang'@'10.105.0.%'
revoke all on *.* from 'test'@'10.105.0.%'
-- identified by '123456';
---- 删除用户,同时对应的赋权也会被删除
drop user 'root'@'%';
mysql用户创建、赋权指定、删除操作
于 2021-06-10 15:53:04 首次发布