LoginSignup
4
4

More than 5 years have passed since last update.

mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1':

Posted at

capistranoでRailsアプリをデプロイ時にこんなエラーが出た。

mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1':

既に同じ状況にぶつかった人がいたので助かりました。理由は以下のURLを参照。
mysqldump: Couldn’t execute ‘SET OPTION SQL_QUOTE_SHOW_CREATE=1’が出た場合の対処法

mysqlが5.6でクライアントが5.5だったので起きた問題。

Railsデプロイ時にスキーマダンプする時に発生するんですね。
解決方法は↑に出揃ってますけど、Railsのデプロイで問題が起きている場合はapplication.rbを一部コメントアウトすることでプロイできるようになります。

config/application.rb
    # Use SQL instead of Active Record's schema dumper when creating the database.
    # This is necessary if your schema can't be completely dumped by the schema dumper,
    # like if you have constraints or database-specific column types
    config.active_record.schema_format = :sql # ここをコメントアウト

ただ、これをやっちゃうとstructure.sql or schema.rbをダンプしてくれなくなるので、古いmigrationファイルを移動できなくなってしまうんですよね。緊急でインフラに手を入れられないとかそんな状況の時にしか使えない対応だな。

4
4
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
4
4