/*DCL 用于管理数据库用户,控制数据库的访问权限*/
/*DCL 管理用户*/
/* 查询用户 use mysql;
select * from user; */
use mysql;
select * from user;
/*创建用户 create user '用户名'@‘主机名’ identified by '密码';*/
/*创建用户 itcast,只能在当前主机localhost访问,密码123456*/
create user 'itcast'@'localhost' identified by '123456';
/*创建用户heima,可以在任意主机访问该数据库,密码123456*/
create user 'heima'@'%' identified by '123456';
/*修改用户密码alter user '用户名'@'主机名' identified with mysql_native_password by '新密码';*/
/*修改heima的访问密码为1234*/
alter user 'heima'@'%' identified with mysql_native_password by '1234';
/*删除用户 drop user '用户名'@'主机名';*/
/*删除itcast@localhost用户*/
drop user 'itcast'@'localhost';
[MySQL]DCL-用户管理
最新推荐文章于 2024-07-06 19:29:43 发布