MySQL 表结构字段 face char(20) NOT NULL 。
插入数据的时候,当face值设置为NULL,报错 MySQL SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'face' cannot be null
MariaDB [db2_dalu]> select version();
+--------------------+
| version() |
+--------------------+
| 5.5.41-MariaDB-log |
+--------------------+
1 row in set (0.00 sec)
但是我本地却没有这样的情况,本地的MySQL版本:
mysql> select version();
+------------+
| version() |
+------------+
| 5.6.17-log |
+------------+
1 row in set (0.00 sec)
mysql>
What’s the point of posting this? It’s obviously a problem during insertion. You should post the inserted code.
And I think there is nothing wrong with the prompt, because you require that it cannot be empty. When you insert a null value, it would be strange not to remind you.
Obviously not null is set, so null values cannot be inserted. You said before that the local version can be inserted. This must be a supernatural phenomenon.
Is it because the higher version has stricter restrictions?
This. . Whether in MySQL's strict mode or non-strict mode, you can set whether to remind you of null values.