MySQL系列——DCL语句

#一、创建用户
#a、创建用户
#create user 'username'@'host' identified by 'password';
-- create user 创建用户的名称
-- username 定义用户名
-- host ip地址 1. localhost 本机 2. % 所有的能连 3.192.168.23.123 具体的ip地址
-- identified by 创建密码
-- password 设置密码



create user "zhangsan"@'localhost' identified by'12345';


#b、查看用户
use mysql;
select *from user;



#c、修改密码
alter user 'zhangsan'@'localhost' identified by'1756336885';


#d、删除
drop user 'lisi'@'%';




#二、授权
#a、授权

#全部授权
grant all on emp to 'zhangsan'@'localhost';

#部分授权
grant select,update,alter on *.* to 'zhangsan'@'localhost';
grant insert on emp to 'zhangsan'@'localhost';


#b、取消授权
#取消全部授权
revoke select,update,alter on *.* from 'zhangsan'@'localhost';

#取消部分授权
revoke all on *.* from 'zhangsan'@'localhost';


#三、权限更新
flush PRIVILEGES;
















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