首页 > 解决方案 > CloudSQL 只读副本 - 无法执行停止从属,跳过命令

问题描述

我的复制卡在了一些Last_SQL_Error地方 Slave_SQL_Running: No

现在我要执行:

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; 
START SLAVE;

但我不能:

mysql> STOP SLAVE;
ERROR 1045 (28000): Access denied for user 'someuser'@'%' (using password: YES)
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation.

用户是通过 Google Cloud Platform -> SQL -> 选择只读副本实例 -> 用户 -> 创建用户帐户创建的。

那里说:Users created by using the Cloud Console have the same privileges as the root user.

但它仍然没有超级权限(比我在常见问题解答中看到的)

Cloud SQL does not support SUPER privileges, which means that GRANT ALL PRIVILEGES statements will not work. As an alternative, you can use GRANT ALL ON `%`.*.

但它不起作用:

mysql> GRANT ALL ON `%`.* TO 'someuser'@'%' WITH GRANT OPTION;
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement

那么我怎样才能让复制再次工作呢?

标签: mysqlgoogle-cloud-sql

解决方案


由于GCP SQL 上的 root 用户没有SUPER 权限,因此您不能使用 stop slave 命令,因为它需要它。您可以随时使用GCP UI上的“DISABLE REPLICATION”停止复制。

如果复制在此过程中停止(或卡住),您在问题跟踪器上打开一个问题,我们也许可以从我们这边进行调查。


推荐阅读