問題描述
我正在學習 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 選項運行,因此它無法執(zhí)行此語句
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
我該如何解決這個錯誤?
How do I tackle this error?
我已經檢查了 關于同一錯誤消息的另一個問題,但仍然找不到解決方案.
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 LIKE "secure_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
.這必須從啟動中刪除,不能動態(tài)修改.為此,請檢查您的 MySQL 啟動參數(shù)(取決于平臺)和 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.
這篇關于我應該如何處理 MySQL 中的 --secure-file-priv?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!