I am trying to run a rails mysql migration on Amazon Elastic Beanstalk.

It fails with this error message:

Mysql2::Error: BLOB/TEXT column 'description' can't have a default value: ALTER TABLE items ADD description text DEFAULT ''

I found out from this thread that Amazon RDS might be in strict mode. How do I change the mode?

1 Answer 1


BLOB, TEXT, GEOMETRY, and JSON columns cannot be assigned a default value.


What you are in essence asking -- without realizing it, presumably -- is how to force MySQL to revert to its old, incorrect behavior of ignoring your incorrect table definition and pretending that you really said ALTER TABLE items ADD description text NOT NULL but with the default value missing because that is the only alternative. So you are left with a nonsensical table definition.

The new, correct behavior is indeed tied to the new recommended @@SQL_MODE defaults. You're going to make trouble for yourself it your preferred solution is to unfix the server, rather than unbreak your table definition.

I understand that this is "working" for you now, but my point is that it is still in fact broken. SHOW CREATE TABLE should reveal that your declared default value is in fact not there on your current production server.

  • its a table definition that already exist and is already working in production. Just not on aws.
    – Sam Nyavor
    Jul 7, 2016 at 18:46
  • ALTER TABLE ... to make it 'correct'?
    – Rick James
    Jul 12, 2016 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.