title: Mysql2::Error: BLOB, TEXT, GEOMETRY or JSON column 'body' can't have a default value
body: <p>I have migration:</p>
  
  <pre><code>lass ChangeDefaultValueBodyForBlogPosts &lt; ActiveRecord::Migration
    def up
      change_column :blog_posts, :body, :text, :null =&gt; false
      change_column :comments, :text, :text, :null =&gt; false
    end
  
    def down
      change_column :comments, :text, :text, :default =&gt; nil
      change_column :blog_posts, :body, :text, :default =&gt; nil
    end
  end
  </code></pre>
  
  <p>rake db:migrate display error: </p>
  
  <p><strong>Mysql2::Error: BLOB, TEXT, GEOMETRY or JSON column 'body' can't have a default value: ALTER TABLE <code>blog_posts</code> CHANGE <code>body</code> <code>body</code> text DEFAULT '' NOT NULL/home/user/projects/projectname/db/migrate/20120508203410_change_default_value_body_for_blog_posts.rb:3:in `up'</strong></p>
  
  <p>I use ubuntu 16.04, </p>
  
  <p>mysql server 5.7(Version: 5.7.12-0ubuntu1.1
  Version: 5.7.12-0ubuntu1
  Version: 5.7.11-0ubuntu6
  )</p>
  
  <p>I looked in google, solving this issue need change </p>
  
  <p>sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"</p>
  
  <p>to</p>
  
  <pre><code>sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
  </code></pre>
  
  <p>But my.conf file is empty. </p>
  
  <pre><code>#
  # The MySQL database server configuration file.
  #
  # You can copy this to one of:
  # - "/etc/mysql/my.cnf" to set global options,
  # - "~/.my.cnf" to set user-specific options.
  # 
  # One can use all long options that the program supports.
  # Run program with --help to get a list of available options and with
  # --print-defaults to see which it would actually understand and use.
  #
  # For explanations see
  # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
  
  #
  # * IMPORTANT: Additional settings that can override those from this file!
  #   The files must end with '.cnf', otherwise they'll be ignored.
  #
  
  !includedir /etc/mysql/conf.d/
  !includedir /etc/mysql/mysql.conf.d/
  </code></pre>
  
  <p>How solve this issue, please help. Thank you.   </p>