AWS Aurora:MySQL 服务器是 运行 --read-only 选项,因此它无法执行此语句

AWS Aurora: The MySQL server is running with the --read-only option so it cannot execute this statement

我在 AWS 中的 Aurora 数据库实例上执行 GRANT 语句时遇到此错误:

The MySQL server is running with the --read-only option so it cannot execute this statement

虽然我的用户不是只读的,但为什么会这样?

事实证明这是一个愚蠢的错误,但无论如何都会发布它以防其他人遇到问题:

我错误地访问了副本实例 - 我复制了副本的端点,它显然是只读的。因此,如果您遇到此问题,请确认您正在连接到主实例或最好的所有数据库集群端点。

编辑: 根据@Justin 的回答,我们绝对应该使用数据库集群:

You need to connect to the cluster, rather than an instance. This is because instances seem to take a turn to be the readers and writers.

您需要连接到集群,而不是实例。这是因为实例似乎轮流成为读者和作者。