今天需要在線上環境中檢索數據,由於數據量較大,採用into outfile
語句,然而獲取如下提示
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv opti
on so it cannot execute this statement
查詢資料,輸入show variables link '%secure%';
來查看相關配置信息,獲取結果如下圖所示。
參考資料中是更改MySQL的配置文件,但是本次是線上環境,重啓或平滑重啓等操作還是不敢弄,於是把導出內容文件直接放到目錄/var/lib/mysql-files
下,使用完刪除文件即可。
SELECT * from xxx where xxx into outfile "/var/lib/mysql-files/out.csv";
問題到此解決,特此記錄。
參考:https://blog.csdn.net/man_to_home/article/details/54947518