Mysql::Error: BLOB/TEXT column 'any_column_name' can't have a default value

Recently I downgraded my mysql version from 5.1.30 to 5.0.27. But while running database migrations for my rails application it was showing message like 'Mysql::Error: BLOB/TEXT column 'any_column_name' can't have a default value' which was not showing previously. After searching through mysql community blogs finally I got the solution for it. It was not a bug rather it was a feature for type BLOB/TEXT not to have any default value in strict mode, not even empty string. So, the workaround was to just change my my.ini file a little. It should be located in your mysql installation directory. You just need to comment out the line
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
This solved my problem. Hopefully this will fix your problem too.

Comments

Post a Comment