CREATE DATABASE test;
use test;
create user 'U1'@'localhost' IDENTIFIED by '123456';
create user 'U2'@'%' IDENTIFIED by '123456';
create user 'U3';
rename user 'U1'@'localhost' to 'U5'@'localhost';
set password for user 'U5'@'localhost' ='abc';
drop user 'U5'@'localhost';
登录 mysql -U U2 -P 123456
grant
with grant option 可以权限转授
grant select,update(grade)
on sc
to 'U4'@'localhost'
with grant option;
show grants for 'U4'@'localhost';
create user 'hong'@'localhost' IDENTIFIED by '123',user 'liu'@'localhost' IDENTIFIED by '456';
grant select,update(grade) on sc to 'hong'@'localhost','liu'@'localhost' with grant option;
grant all on student * on 'U2'
grant create,drop on *.* to'U2'@'locallhost';
grant select,update on *.* to'U4'@'locallhost';
on 数据库 to用户
回收权利
grant option for 只有授权权限收回
cascade
revoke uodate on student.s form 'U4'@'localhost'; student数据库中的S表