MySQL5.6.6 not so silent

March 26, 2013

In version 5.5 when you insert data into a column that is too long, MySQL truncates the data and creates a warning like so:

If you are not checking for warnings in your code you will be failing silently.

In version 5.6.6 onwards MySQL throws an actual error:

This is because by default 5.6.6 comes with sql_mode set to STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION.

If this is causing issues you can set sql_mode back to the pre 5.6.6 value by setting set global sql_mode = ''; while the server is running and sql_mode='' in your my.cnf file. Or you can fix your schema ;)

Discussion, links, and tweets

If you like what I have to say you can Follow me on Twitter