LoginSignup
11
10

More than 5 years have passed since last update.

AWS/RDS/MySQL5.7を複製する

Posted at

やりたいこと

  • AWS/RDS/MySQL5.7のDBをもう一つ別に作りたかった

やること

  • 元DBからdumpを取得して、新DBにインポートする

RDSの設定変更

  • RDS カスタムパラメーターグループの大域 log_bin_trust_function_creators システム変数に 1 を設定

ハマったこと

  • 元DBからdump取得までは良かったが、インポートするときにエラー出まくった

コマンド

mysqldump -u <user_name> -p<password> -h <host> --quick --single-transaction --skip-triggers --compress --order-by-primary --databases <database_name> > <output_file>
  • パスワードは-pにスペース無しで記述(警告は出る mysql: [Warning] Using a password on the command line interface can be insecure.
  • --skip-triggersオプションでtriggerに関わるエラーを回避

エラー内容

ERROR 1227 (42000) at line <line number>: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

対処したこと

  • dumpファイルのエラーの箇所を全部修正

削除したもの

  • SET @@SESSION.SQL_LOG_BIN= 0;
  • SET @@GLOBAL.GTID_PURGED='';
  • SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;

これでなんとかインポートできました。

参考にしたもの(ほぼこの記事のおかげ)

いつもQiitaに助けられてます。感謝。

11
10
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
11
10