/为struts用户分配权限/
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;
/创建spring用户 ,为该用户分配spring 数据库的所有权限/
/创建spring用户/
INSERT INTO USER(HOST,USER,PASSWORD)
VALUE('localhost','spring',PASSWORD('spring'));
/为该用户分配spring 数据库的所有权限/
GRANT ALL PRIVILEGES ON spring.* TO spring@localhost IDENTIFIED BY 'spring';
FLUSH PRIVILEGES;
/创建springmvc用户 ,为该用户分配springmvc 数据库的所有权限/
/创建springmvc用户/
INSERT INTO USER(HOST,USER,PASSWORD)
VALUE('localhost','springmvc',PASSWORD('springmvc'));
/为该用户分配springmvc 数据库的所有权限/
GRANT ALL PRIVILEGES ON springmvc.* TO springmvc@'localhos IDENTIFIED BY 'springmvc' WITH GRANT OPTION;
FLUSH PRIVILEGES;
/创建springmvc1用户 ,为该用户分配springmvc 数据库的所有权限/
/创建springmvc1用户/
INSERT INTO USER(HOST,USER,PASSWORD)VALUE('localhost','springmvc1',PASSWORD('springmvc1'));
FLUSH PRIVILEGES;
/为该用户分配springmvc 数据库的所有权限/
GRANT ALL PRIVILEGES ON springmvc.* TO springmvc1@'localhost' IDENTIFIED BY 'springmvc1'WITH GRANT OPTION;
FLUSH PRIVILEGES;
/收回所有权限/
REVOKE ALL PRIVILEGES ON springmvc.* FROM springmvc1@'localhost';
/将spring用户的create,INSERT,UPDATE,DELETE 权限收回/
REVOKE CREATE ON spring.* FROM spring@'localhost';
FLUSH PRIVILEGES;
REVOKE INSERT,UPDATE,DELETE ON spring.* FROM spring@'localhost';
FLUSH PRIVILEGES;
/将收回的权限重新进行授予/
GRANT CREATE,INSERT,UPDATE,DELETE ON spring.* TO spring@'localhost' IDENTIFIED BY 'spring';
SELECT * FROM USER;
网友评论