mysqlsql-mode

Is it safe for me to turn off STRICT_TRANS_TABLES?


My PHP/mySQL backend hosted on an external site has been running fine since 2014. Recently, it started throwing up "field has no default value" errors.

I checked the config and found STRICT_TRANS_TABLES, which gives these errors for fields with no default in some cases.

My question is whether or not it is safe for me to remove this config value. It's mySQL 5.5.5-10.3.12-MariaDB.

Alternatively I could give everything default values, but I don't know which of these solutions is more likely to cause the existing codebase to stop working properly.


Solution

  • I encourage use of strict mode in MySQL because if you disable strict mode, you risk causing some unwanted effects, such as:

    Will these cases affect your app? There's no way I or anyone else on Stack Overflow can predict that. You need to test it yourself.