我使用root创建了一个用户(new_user):
GRANT ALL ON labor.* TO 'new_user'@'%' WITH GRANT OPTION;
GRANT ALL ON labor.* TO 'new_user'@'localhost' WITH GRANT OPTION;
GRANT CREATE USER ON *.* TO 'new_user'@'%';
GRANT CREATE USER ON *.* TO 'new_user'@'localhost';
GRANT RELOAD ON *.* TO 'new_user'@'localhost';
GRANT RELOAD ON *.* TO 'new_user'@'%';
FLUSH PRIVILEGES;
当我尝试以相同的方式创建另一个用户但使用new_user时,我收到拒绝访问错误。 在GRANT ALL行之后发生此错误。
我还应该添加什么特权?
答案 0 :(得分:14)
新创建的用户缺少*.*
上的授权选项(grant create user on *.* ...
所需)
GRANT GRANT OPTION ON *.* TO 'new_user'@'%';
GRANT GRANT OPTION ON *.* TO 'new_user'@'localhost';