1. 程式人生 > >mysql資料庫-1.檔案匯入mysql表secure_file_priv報錯問題解決 mysql select outfile不能匯出親測

mysql資料庫-1.檔案匯入mysql表secure_file_priv報錯問題解決 mysql select outfile不能匯出親測

1.問題
Mac系統,將檔案匯入mysql表中,報錯secure_file_priv選項未設定。
執行匯入檔案到表mobile_attribute_jxl命令時:
load data infile ‘/home/dm_mobile.txt' into table mobile_attribute_jxl fields terminated by ',' lines terminated by '\n';

報錯:
Error: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

2.解決方案
SHOW VARIABLES LIKE "secure_file_priv”;
發現其值為NULL,此時需要在修改secure_file_priv的設定
secure_file_prive=null   -- 限制mysqld 不允許匯入匯出
secure_file_priv=/tmp/   -- 限制mysqld的匯入匯出只能發生在/tmp/目錄下
secure_file_priv=''     -- 不對mysqld 的匯入 匯出做限制

1.找到 /private/etc/my.cnf
2.在my.cnf中新增加粗部分語句即可
[mysqld]
max_connections=1024
secure_file_priv=''
[mysql]
Default-character-set=utf8mb4
3.重啟mysql伺服器
重新匯入即可
--------------------- 
作者:JackieChen1992 
來源:CSDN 
原文:https://blog.csdn.net/cshichunhua/article/details/78535755?utm_source=copy 
版權宣告:本文為博主原創文章,轉載請附上博文連結!

來源:https://blog.csdn.net/cshichunhua/article/details/78535755