1.创建用户
CREATE USER 'dingyingsi'@'localhost' IDENTIFIED BY 'dys123'; //将该用户创建在本机上CREATE USER 'dingyingsi'@'%' IDENTIFIED BY 'dys123'; //创建的用户可以远程连接本机
2.授权
grant select,insert,update,delete,create,drop on dys.tb1 to 'dingyingsi'@'localhost';grant all privileges on dys.tb1 to 'dingyingsi'@'localhost'; grant all privileges on *.* to 'dingyingsi'@'localhost';
3.查看授权
SHOW GRANTS FOR 'dingyingsi'@'localhost'
4.撤销权限
revoke all privileges on *.* from 'dingyingsi'@"%"; revoke all on db1.tb1 from 'dingyingsi'@"%"; revoke all on db1.* from 'dingyingsi'@"%";