MySQL’s strict mode

For example, if an integer field is written to a string, MySQL will not report an error in non-strict mode. Similarly, if a char or vARCHar field is defined, MySQL will not report an error. No error is reported when data written or updated exceeds the defined length.

Open the configuration file/etc/mysql/conf. D/mysql. CNF, add the following code

[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Copy the code

Restart the service

sudo service mysql restart
Copy the code