MathJax

SyntaxHighlighter

Highlight

Custom CSS

Friday, September 15, 2006

MySQL 5 Data Truncation Errors

When migrating from MySQL 4 to 5, a lot of code broke for me. I got errors like:
Data too long for column 'xxx'
This is because MySQL is a lot stricter than MySQL4. You can turn off the strictness by modifying the my.ini file in your MySQL installation directory and modifying this line:
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
And changing it to...
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Additionally, you may want to append ?jdbcCompliantTruncation=false to any JDBC connnection URLs you have.
Post a Comment