Because of some default settings in the project, and for various reasons, MySQL database needs to be developed in a non-strict mode (the most recent version of MySQL is turned on in strict mode by default).
Under Linux MySQL service, the following steps are:
1. Enter MySQL Service
2, the implementation of the set operation modification, our project is directly set to "
mysql> set global sql_mode= '; #这种方法修改, after the current session is invalidated, this modification is meaningless, and it is recommended to modify the configuration file in a way that modifies
3, after the modification, do not need to restart the MySQL service, effective immediately
4, check whether the effective, execute SQL
SELECT @ @sql_mode;
Modify by configuration file:
Linux Find my.cnf file
Window was modified by looking for My.ini.
Sql_mode=no_engine_substitution,strict_trans_tables
Strict mode is mainly used in the following scenarios
- Inserting null values on NOT NULL fields is not supported
- Inserting "value to self-growing field" is not supported
- The text field is not supported with a default value
About MySQL strict mode on, off