我应该如何解决--secure-file-priv在MySQL? [英] How should I tackle --secure-file-priv in MySQL?
问题描述
我正在学习MySQL并尝试使用 LOAD DATA
子句。当我使用它如下:
I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE "text.txt" INTO table mytable;
我收到以下错误:
MySQL服务器正在使用--secure-file-priv选项运行,因此无法执行此语句
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
我如何解决此错误?
我已选中另一个问题对同一错误消息,但仍然找不到解决方案。
I have checked another question on the same error message, but still can’t find a solution.
我正在使用MySQL 5.6
I am using MySQL 5.6
推荐答案
您的MySQL伺服器已开始使用 - secure-file-priv 选项,它基本上限制从哪些目录可以使用 LOAD DATA INFILE
加载文件。
It's working as intended. Your MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE
.
您可以使用 SHOW VARIABLES LIKEsecure_file_priv;
查看已配置的目录。
You may use SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that has been configured.
您有两个选项:
- 将档案移至指定的目录
secure-file-priv
。 - 禁用
secure-file-priv
。这必须从启动中移除,且不能动态修改。为此,请检查您的MySQL启动参数(取决于平台)和my.ini。
- Move your file to the directory specified by
secure-file-priv
. - Disable
secure-file-priv
. This must be removed from startup and cannot be modified dynamically. To do this check your MySQL start up parameters (depending on platform) and my.ini.
这篇关于我应该如何解决--secure-file-priv在MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!