Open2
DatastreamでAWS RDS のMySQLで collationによりmysql.rds_set_configurationできない問題

Google Cloud のDatastreamを使ってAWS のRDS のMySQLへ接続したい。
その手順にあるコマンド実行ができない。
バイナリログの保持期間を設定する at Amazon RDS MySQL データベースを構成する
対象コマンドは call mysql.rds_set_configuration('binlog retention hours', 168);
実際の結果
mysql> call mysql.rds_set_configuration('binlog retention hours', 168);
ERROR 1267 (HY000): Illegal mix of collations (utf8mb4_0900_ai_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '='
原因
collation。
- MySQLのcollationを
utf8mb4_general_ci
で統一している - ストアドプロシージャである
mysql.rds_set_configuration
はmysql.rds_configuration
を参照し、比較している - その比較するカラムのcollationが
utf8mb4_0900_ai_ci
である - そのためストアドプロシージャ内部で
utf8mb4_general_ci
とutf8mb4_0900_ai_ci
を比較しており、エラー - コマンドラインで実行される文字列が
utf8mb4_general_ci
で、比較するテーブルカラムがutf8mb4_general_ci
なのでエラーになっている、と理解している
解決方法
探し中。
わかっていること
現在、RDSのパラメータグループ 内の init_connect の値でset default_collation_for_utf8mb4=utf8mb4_general_ci;
をパラメータグループで設定している。
これを削除すれば、call mysql.rds_set_configuration('binlog retention hours', 168);
を実行できる。
init_connect
5.1.8 サーバーシステム変数: default_collation_for_utf8mb4
やりたいこと
default_collation_for_utf8mb4の変更は影響範囲がおおきい。
1回コマンドを実行で、mysql.rds_configuration
の値を更新できればいいので回避策を探し中

内容確認用コマンドメモ
mysql.rds_set_configurationの内容確認
SHOW CREATE PROCEDURE mysql.rds_set_configuration \G;
mysql.rds_configurationのカラム構造確認
SHOW FULL COLUMNS FROM mysql.rds_configuration;
mysql.rds_configurationのテーブル内容の確認
select * from mysql.rds_configuration;
変数確認
show variables like '%collation%';