Tag Archives: :SQLSTATE[HY000]: General error: 1364 Field ‘xxxxx’ doesn’t have a default value

MYSQL Insert: SQLSTATE[HY000]: General error: 1364 Field ‘xxxxx’ doesn’t have a default value

The first time you encounter a problem, you have to keep a diary

MySQL error prompt:

SQLSTATE[HY000]: General error: 1364 Field ‘xxxxx’ doesn’t have a default value

This report is translated as follows:

The details field has no default value; That is to say, we have not assigned a value to it, and there is no default value set for this field in the table. This is something that was created after MySQL 5 came out. Take a serious look at my.ini file

I used the pagoda to check the following MySQL configuration:

#This paragraph

sql-model=NO_ ENGINE_ SUBSTITUTION,STRICT_ TRANS_ TABLES

Take a look at No_ ENGINE_ Division official explanation:

When using alter table or create table to specify engine, the required storage engine is disabled or not compiled. What should be done. Enable no_ ENGINE_ When substitution , the error will be thrown directly; When this value is not set, create is replaced by the default storage engine, atler does not change and throws a warning

Take another look at strict_ TRANS_ Official explanation of tables:

Indicates that strict mode is enabled

Look again: No_ AUTO_ CREATE_ USER

Grant is not allowed to create users with empty password

Baidu solved the problem in a circle. If you forget what you found, you can write a record by yourself. The reason for the problem is that MySQL uses strict verification method

Solution: directly change the SQL model mode to the following figure:

sql-mode=NO_ AUTO_ CREATE_ USER,NO_ ENGINE_ SUBSTITUTION