在 MySQL workbench 中执行 GRANT 命令时用户访问被拒绝

Access denied for user while executing the GRANT command in MySQL workbench

grant select ON . TO 'username'@'%' with GRANT OPTION; grant select ON . TO 'username'@'IPaddress' with GRANT OPTION;

以上所有语句均出错,错误代码为:1044。拒绝用户 'user'@'IPAddress' 访问数据库

仅供参考,我以具有所有权限的用户身份登录 -- 'GRANT ALL PRIVILEGES ON . '

  1. 对于当前用户,我可以执行所有操作,但我想添加更多用户。

您需要使用具有 WITH GRANT OPTION 的用户登录,例如 root@'localhost'。否则,您可以执行其他所有操作,但创建新用户并发布新的 grants/permissions.

GRANT OPTION Enable privileges to be granted to or removed from other accounts. Levels: Global, database, table, procedure.

您可以在此处阅读更多内容dev.mysql