1. Home >
  2. Apps >
  3. Groups >

What are the disadvantages of turning MySQL strict mode off?

Question asked by Kaustubh Katdare in #Databases on Jul 15, 2019
Kaustubh Katdare
Kaustubh Katdare · Jul 15, 2019
Rank A1 - PRO

I've ran into an issue which can be easily solved by turning off the "strict" mode in MySQL. I'm however not in favor of turning it off just to have my query work. 

Can someone inform me what are the disadvantages of disabling the strict mode? If I'm sanitizing all the data being sent to the DB; should I still care about the strict mode? 

Thank you in advance. 

Posted in: #Databases
Hitesh Riziya
Hitesh Riziya · Aug 1, 2019

Strict mode works exactly how it sounds.

As per my experience with mysql..

With strict mode off.. if you try to insert the long data compared to what the max length is defined..mysql will convert it to column datatype and truncate the value to max allowed limit. It means, you will not get an error. However with strict mode, data will not be inserted and error will be thrown.

Another example is datetime column being not null will not allow you to insert record without a valid value if strict mode is ON. With mode off, it will automatically insert the zero datetime value like 0000-00-00 00:00:00

More info here..


Upgrading to MySQL 5.7? Beware of the new STRICT mode

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up