【MySQL】管理用户

DCL-管理用户

查询用户

use mysql;
select * from user;

创建用户

create user '用户名'@'主机名' identified by '密码';

修改用户密码

alter user '用户名'@'主机名' identidied with mysql_native_password by '新密码';

删除用户

drop user '用户名'@'主机名';

创建用户test,只能够再当前主机localhost访问,密码为123456

create user 'test'@'localhost' identified by '123456';

创建用户test1,可以再任意主机访问该数据库,密码为123456

create user 'test1'@'%' identified by '123456';

修改用户test的密码为1234

alter user 'test'@'localhost' identified with mysql_native_password by '1234';

删除用户test

drop user 'test'@'localhost';

你可能感兴趣的:(MySQL,mysql,数据库)