/為struts用戶分配權(quán)限/
INSERT INTO USER(USER,PASSWORD) VALUE('struts','struts');
UPDATE USER SET PASSWORD=PASSWORD('struts') WHERE USER='struts';
GRANT ALL PRIVILEGES ON struts TO struts;
FLUSH PRIVILEGES;
/創(chuàng)建spring用戶 鸟顺,為該用戶分配spring 數(shù)據(jù)庫的所有權(quán)限/
/創(chuàng)建spring用戶/
INSERT INTO USER(HOST,USER,PASSWORD)
VALUE('localhost','spring',PASSWORD('spring'));
/為該用戶分配spring 數(shù)據(jù)庫的所有權(quán)限/
GRANT ALL PRIVILEGES ON spring.* TO spring@localhost IDENTIFIED BY 'spring';
FLUSH PRIVILEGES;
/創(chuàng)建springmvc用戶 ,為該用戶分配springmvc 數(shù)據(jù)庫的所有權(quán)限/
/創(chuàng)建springmvc用戶/
INSERT INTO USER(HOST,USER,PASSWORD)
VALUE('localhost','springmvc',PASSWORD('springmvc'));
/為該用戶分配springmvc 數(shù)據(jù)庫的所有權(quán)限/
GRANT ALL PRIVILEGES ON springmvc.* TO springmvc@'localhos IDENTIFIED BY 'springmvc' WITH GRANT OPTION;
FLUSH PRIVILEGES;
/創(chuàng)建springmvc1用戶 器虾,為該用戶分配springmvc 數(shù)據(jù)庫的所有權(quán)限/
/創(chuàng)建springmvc1用戶/
INSERT INTO USER(HOST,USER,PASSWORD)VALUE('localhost','springmvc1',PASSWORD('springmvc1'));
FLUSH PRIVILEGES;
/為該用戶分配springmvc 數(shù)據(jù)庫的所有權(quán)限/
GRANT ALL PRIVILEGES ON springmvc.* TO springmvc1@'localhost' IDENTIFIED BY 'springmvc1'WITH GRANT OPTION;
FLUSH PRIVILEGES;
/收回所有權(quán)限/
REVOKE ALL PRIVILEGES ON springmvc.* FROM springmvc1@'localhost';
/將spring用戶的create讯嫂,INSERT,UPDATE,DELETE 權(quán)限收回/
REVOKE CREATE ON spring.* FROM spring@'localhost';
FLUSH PRIVILEGES;
REVOKE INSERT,UPDATE,DELETE ON spring.* FROM spring@'localhost';
FLUSH PRIVILEGES;
/將收回的權(quán)限重新進行授予/
GRANT CREATE,INSERT,UPDATE,DELETE ON spring.* TO spring@'localhost' IDENTIFIED BY 'spring';
SELECT * FROM USER;