mysql secure-file-priv ='''

发布于 2025-01-17 13:13:08 字数 619 浏览 3 评论 0原文

我有下一个问题:我想在表中插入图像(longblob)。首先,我成功地从c:\\ programData \\ mysql \\ mysql Server 8.0 \\ uploads(secure-file-priv =“ c:\ programData \ mysql \ mysql \ mysql server) 8.0 \ uploads”),然后我设置了Secure-File-priv =“”,以便从任何位置插入图像,但插入了空值。我可以从任何位置上传图像吗?如果是这样,怎么样?

这是我的表:

“在此处输入映像”

,这是查询:

INSERT INTO `soccertrackerdev`.`test`(`id`,`image`)
VALUES(4, LOAD_FILE('C:/Users/ionut.puiu/Desktop/Untitled.png'));

运行查询后的消息是:

“在此处输入图像说明”

I have next problem: I want to insert in a table an image (LONGBLOB). First of all, I successfully inserted the image from C:\\ProgramData\\MySQL\\MySQL Server 8.0\\Uploads (secure-file-priv = "C:\ProgramData\MySQL\MySQL Server 8.0\Uploads") and then I set secure-file-priv="" in order to insert images from any location but NULL value is inserted. Can I upload images from any location? If so, how?

This is my table:

enter image description here

And this is the query:

INSERT INTO `soccertrackerdev`.`test`(`id`,`image`)
VALUES(4, LOAD_FILE('C:/Users/ionut.puiu/Desktop/Untitled.png'));

And the message after run the query is:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

指尖上的星空 2025-01-24 13:13:08

当您在INI文件中设置此时,MySQL开始遵守:(

secure-file-priv=""

在这种情况下,local_infile的设置无关紧要。)

这必须是empty docs

  • 如果空,则变量无效。这不是一个安全的设置。

  • 如果设置为目录的名称,则服务器将导入操作限制为仅与该目录中的文件一起使用。目录必须存在;服务器不创建它。

  • 如果设置为null,则服务器禁用导入和导出操作。

When you set this in your ini file, MySQL starts to obey:

secure-file-priv=""

(The setting for local_infile does not matter, in this case.)

This must be the difference between empty and set to NULL in the docs:

  • If empty, the variable has no effect. This is not a secure setting.

  • If set to the name of a directory, the server limits import and export operations to work only with files in that directory. The directory must exist; the server does not create it.

  • If set to NULL, the server disables import and export operations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文