- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将图像插入 MySQL 数据库,但我一直收到此错误;错误代码:1048。
Column 'image' cannot be null. This is the code I am using.
create table test_img (
id int(10) not null AUTO_INCREMENT PRIMARY KEY,
name varchar(25) not null default '',
image blob not null
)
INSERT INTO test_img(ID,IMAGE) VALUES(1,LOAD_FILE ('C:\\human_centered_design_infographic.jpg'));
最佳答案
来自MySQL manual :
LOAD_FILE(file_name)
Reads the file and returns the file contents as a string. To use this function, the file must be located on the server host, you must specify the full path name to the file, and you must have the FILE privilege. The file must be readable by all and its size less than max_allowed_packet bytes. If the secure_file_priv system variable is set to a nonempty directory name, the file to be loaded must be located in that directory.
If the file does not exist or cannot be read because one of the preceding conditions is not satisfied, the function returns NULL.
您可能会收到 NULL 错误,因为所提到的条件之一适用。
它不是所有人都可读的,或者服务器没有启用文件权限,或者文件大于 max_allowed_packet
字节。
关于mysql - 我正在尝试将图像保存在 mySQL 数据库中,但我收到一条错误消息,它是空的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54309736/
我是一名优秀的程序员,十分优秀!