1.建立用户spa
CREATE USER 'dingyingsi'@'localhost' IDENTIFIED BY 'dys123'; //将该用户建立在本机上 CREATE USER 'dingyingsi'@'%' IDENTIFIED BY 'dys123'; //建立的用户能够远程链接本机
2.受权code
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.查看受权blog
SHOW GRANTS FOR 'dingyingsi'@'localhost'
4.撤销权限class
revoke all privileges on *.* from 'dingyingsi'@"%"; revoke all on db1.tb1 from 'dingyingsi'@"%"; revoke all on db1.* from 'dingyingsi'@"%";