一、用户
1.创建用户
CREATE USER 'test1'@'localhost' identified BY 'test1';
2.删除用户
DROP USER 'test2'@'localhost';
二、权限分配
1.查询用户权限
SHOW GRANTS FOR 'test1'@'localhost';
2.分配权限
# 分配用户所有权限在for_end_test库的test1表
GRANT ALL PRIVILEGES ON for_end_test.test1 TO 'test1'@'localhost';
# 分配用户可查询权限在for_end_test库的test1表
GRANT SELECT ON for_end_test.test1 TO 'test1'@'localhost';
3.移除权限
# 收回用户可查询权限在for_end_test库的test1表
REVOKE SELECT ON for_end_test.test1 FROM 'test1'@'localhost';
4.权限生效
FLUSH PRIVILEGES;