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'@"%";