我正在使用tx_sfbooks扩展来添加图书到我的网站。
当我添加一个新记录时,我得到以下错误:
2: SQL error: 'Field 'cover' doesn't have a default value' (tx_sfbooks_domain_model_book:NEW60807a6c5dce2359862008)我试图为表tx_sfbooks_domain_model_book中的字段cover添加一个默认值,但是在mysql上得到一个错误,因为这个字段是BLOB类型的。
我还尝试了禁用严格SQL模式:https://stackoverflow.com/a/45059826/11541354。
但总是出现相同的错误。
这是一个模式:
#
# Table structure for table 'tx_sfbooks_domain_model_book'
#
CREATE TABLE tx_sfbooks_domain_model_book
(
number tinytext NOT NULL,
title tinytext NOT NULL,
path_segment varchar(2048),
subtitle tinytext NOT NULL,
author tinytext NOT NULL,
isbn tinytext NOT NULL,
series int(11) unsigned DEFAULT '0' NOT NULL,
category int(11) unsigned DEFAULT '0' NOT NULL,
description text NOT NULL,
extras blob NOT NULL,
cover blob NOT NULL,
cover_large blob NOT NULL,
sample_pdf blob NOT NULL,
year varchar(4) DEFAULT '' NOT NULL,
location1 int(11) unsigned DEFAULT '0' NOT NULL,
location2 int(11) unsigned DEFAULT '0' NOT NULL,
location3 int(11) unsigned DEFAULT '0' NOT NULL
);即时通信使用MySQL 8.0.23
发布于 2021-04-22 05:11:32
我通过关闭Mysql strict mode解决了这个问题,命令如下:
mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';" 要进行验证,请运行以下命令:
mysql -u root -p -e "SELECT @@GLOBAL.sql_mode;"你应该看到:
+---------------+------------------------+
| Variable_name | Value |
+---------------+------------------------+
| sql_mode | NO_ENGINE_SUBSTITUTION |
+---------------+------------------------+https://stackoverflow.com/questions/67202282
复制相似问题