1364: Field 'name' doesn't have a default value
MySQLWhat does it mean?
A row was inserted without a value for a column defined as NOT NULL with no DEFAULT. In strict SQL mode MySQL raises an error because it cannot fill in the missing required column automatically.
Why does it happen?
A required (NOT NULL, no DEFAULT) column was omitted from the INSERT, and STRICT_TRANS_TABLES/STRICT_ALL_TABLES is enabled in sql_mode. An application written for the old, permissive mode hits this error when moved to a server with strict mode enabled.
How to fix it
Add a value for the missing column to the INSERT, or define a sensible DEFAULT on the column: ALTER TABLE my_table MODIFY my_column ... NOT NULL DEFAULT 'value'; If the column really is optional, allow NULL. sql_mode can be relaxed as a temporary/compatibility workaround, but keeping strict mode is recommended for data quality.
More from this engine
- 3140ER_INVALID_JSON_TEXT: Invalid JSON text
- 1526ER_NO_PARTITION_FOR_GIVEN_VALUE: Table has no partition for value
- 1049Unknown database 'name'
- 1206The total number of locks exceeds the lock table size
- 1236Got fatal error 1236 from master when reading data from binary log
- 1129Host 'host' is blocked because of many connection errors
- 1194Table 'name' is marked as crashed and should be repaired