Should I disable MySQL strict mode?

Validate the data before inserting it into your database. If a string is too big to fit in your table, either your column is too narrow, or the data is invalid. You need to decide whether you truncate it before storing it, do some error reporting, or both.

Do not turn off the safety features of your DBMS, that's the completely wrong thing to do.


Would you rather have your data silently truncated (possibly leading to broken data) or would you at least like to know that you have a problem?

I'd recommend leaving strict mode enabled and bounds checking your data in your PHP. Your PHP application knows, or at least should know, what to do with a string that's too long. If you turn off strict mode and leave that decision to MySQL then MySQL will silently truncate your strings and you will end up with a database full of garbage.

Changing and fixing code is easy, fixing broken data is often impossible.

If you disable strict mode, you'll end up with strange problems like this:

VARCHAR(4) storing more characters than four