Strict mode in mysql many integrated PHP environments (such as PHPnow WAMP Appserv) do not seem to have enabled the strict mode of MySQL. What is the strict mode of MySQL, simply put, MySQL strictly checks the data (format, length, type, and so on). For example, for an integer field, we write data of the string type, in non-strict mode, MySQL does not report errors. If a char or varchar field is defined, no error is reported if the written or updated data exceeds the defined length. I think this is no good for programming, although we try to do data validation in the code. MySQL has enabled the strict mode. In a certain program, it is a test of our code. If the strict mode is not enabled in our development environment, there is no error during the development process, therefore, incompatibility may occur during online or code porting. Therefore, it is best to enable the MySQL strict mode during the development process. How to enable it? 1. You can enable it by executing an SQL statement, but it is only valid for the current connection. The following is an SQL statement:
Set SQL _mode = "STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION ";
2. Modify the MySQL configuration file, search for SQL-mode in the configuration file, and change this line:
SQL-mode = "STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION"
If SQL-mode = cannot be found, add it to [mysqld]. The second method is recommended.