搭建MySQL+MGR单主模式时提示--super-read-only选项正在使用的解决方法

问题现象描述

搭建MySQL 8.0.18+MGR单主模式过程中,执行alter user 'repl'@'%' IDENTIFIED WITH caching_sha2_password;后提示“The MySQL server is running with the --super-read-only option so it cannot execute this statement”。

关键过程、根本原因分析

主库设置了只读模式,需要关闭只读模式的设置。

结论、解决方案及效果

  1. 关闭主库的只读模式。

    set global read_only=OFF;

  2. 重新执行本例中对应的命令。

    alter user 'repl'@'%' IDENTIFIED WITH caching_sha2_password;