Should I disable MySQL strict mode?

后端 未结 4 802
我在风中等你
我在风中等你 2020-12-11 19:07

I have been working on a site that had MySQL strict mode enabled. One person had a long user agent string that was logged in our log table and unfortunately the user agent s

4条回答
  •  悲哀的现实
    2020-12-11 19:24

    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.

提交回复
热议问题