今天嘗試使用 into outfile 導出數據的時候出現錯誤:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
上網查了一下,應該是 MySQL 設置的權限,可以使用
# 查看 secure-file-priv 當前的值是什麼
show variables like '%secure%';
導出的數據必須是這個值的指定路徑纔可以導出,默認有可能是NULL就代表禁止導出,所以需要設置一下。
知道MySQL安裝路徑下的my.ini文件,設置一下路徑。
然後重啓數據庫即可。