错误代码:1227。访问被拒绝;您需要(至少其中之一)WITH ADMIN、ROLE_ADMIN、SUPER 权限才能执行此操作

问题描述 投票:0回答:1

尝试在我的组织数据库 8.0.mysql_aurora.3.04.0 中运行它

DROP USER IF EXISTS 'USER.NAME'@'%';
CREATE USER `USER.NAME`@`%` IDENTIFIED WITH 'mysql_native_password' AS 'PASSWORD' DEFAULT ROLE `AWS_LAMBDA_ACCESS`@`%`,`AWS_LOAD_S3_ACCESS`@`%`,`AWS_SELECT_S3_ACCESS`@`%` REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT PASSWORD REQUIRE CURRENT DEFAULT;
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE ROLE, DROP ROLE ON *.* TO `USER.NAME`@`%` WITH GRANT OPTION;
GRANT APPLICATION_PASSWORD_ADMIN,BACKUP_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,PASSWORDLESS_USER_ADMIN,SHOW_ROUTINE ON *.* TO `USER.NAME`@`%` WITH GRANT OPTION;
GRANT `AWS_LAMBDA_ACCESS`@`%`,`AWS_LOAD_S3_ACCESS`@`%`,`AWS_SELECT_S3_ACCESS`@`%` TO `USER.NAME`@`%`;

我不确定是什么导致了错误,非常感谢您的帮助。

我已启用 log_bin_trust_function_creators 参数组。但它仍然不起作用,我不知道还能做什么。

mysql amazon-web-services amazon-rds mysql-8.0
1个回答
0
投票

您提供的 SQL 脚本似乎存在一些困难。这些因素中的一个或多个可能会导致您看到的错误。

-- Drop the user if it exists
DROP USER IF EXISTS 'USER.NAME'@'%';

-- Create the user and set its password
CREATE USER 'USER.NAME'@'%' IDENTIFIED WITH 'mysql_native_password' BY 'PASSWORD';

-- Assign roles
GRANT AWS_LAMBDA_ACCESS, AWS_LOAD_S3_ACCESS, AWS_SELECT_S3_ACCESS TO 'USER.NAME'@'%';

-- Set global privileges (modify as needed)
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE ROLE, DROP ROLE ON *.* TO 'USER.NAME'@'%' WITH GRANT OPTION;

-- Set additional privileges (modify as needed)
GRANT APPLICATION_PASSWORD_ADMIN, BACKUP_ADMIN, FLUSH_OPTIMIZER_COSTS, FLUSH_STATUS, FLUSH_TABLES, FLUSH_USER_RESOURCES, PASSWORDLESS_USER_ADMIN, SHOW_ROUTINE ON *.* TO 'USER.NAME'@'%' WITH GRANT OPTION;
© www.soinside.com 2019 - 2024. All rights reserved.