LoginSignup
0
0

More than 1 year has passed since last update.

RDSでMySQL5.6のバイナリログの保持期間が変更できない

Posted at

事象

RDSを使ってMySQL5.6のreplication設定時にバイナリログの保持期間を変更しようとしたときに
ERROR 1694 (HY000): Cannot modify @@session.sql_log_bin inside a transaction
のエラーにより変更できない

結論

クエリ実行する際に SET AUTOCOMMIT=1の設定をいれる

補足

以下クエリ実行時にエラーが発生しました。

mysql> call mysql.rds_set_configuration('binlog retention hours',24);
ERROR 1694 (HY000): Cannot modify @@session.sql_log_bin inside a transaction

こちらはMySQL5.6のバグになっております。
ので、該当バージョンを使っている以上どうしようもなさそうです。

仕方ないので、手動で変更をしようと試みます。

mysql> SET sql_log_bin = 1;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation

これはRDSで発生します。RDSではrdsadminというユーザがSUPER権限をもっており、
自身で作成したユーザにはSUPER権限が付与できません。

一時的にautocommitを1にすることで回避できました。

> SET AUTOCOMMIT=1;
> call mysql.rds_set_configuration('binlog retention hours',24);
> SET AUTOCOMMIT=0;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0