# DCL --- 管理用户
# 1.查询用户
use mysql;
select * from user;
-- 创建用户 iast , 只能够在当前主机localhost 进行访问 ,密码 123456;
create user 'iast'@'localhost ' identified by '123456';
-- 创建用户 hea ,可以在任意主机访问该数据库 ,密码 123456;
create user 'hea'@'%' identified by '123456';
-- 修改用户 hea 的访问密码为 1234 ;
alter user 'hea'@'%' identified with mysql_native_password by '1234';
-- 删除iast @localhost 用户;
drop user 'iast'@'localhost';
# DCL -- 权限控制
-- 查询当前用户所拥有的权限
show grants for 'hea'@'%';
-- 授予权限 (授予hea aiast数据库的所有权限)
grant all on aiast.* to 'hea'@'%';
-- 撤销权限 (撤销hea用户对于 aiast数据库的所有权限)
revoke all on aiast.* from 'hea'@'%';