在使用SELECT...INTO OUTPUT導出數據時報錯ERROR 1290 (HY000),語句如下:
select * into outfile 'd:\abc.txt' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from emp;
MYSQL導出數據報錯”ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement”
分析:提示信息-secure-file-priv可看出是文件導出做了限制。所以在配置中修改限制信息。
說明:
secure_file_prive=null 限制mysqld 不允許導入導出
secure_file_priv=” C:/ProgramData/MySQL/MySQL Server 8.0/Uploads” 限制mysqld的導入導出只能發生在C:/ProgramData/MySQL/MySQL Server 8.0/Uploads目錄下
secure_file_priv=' ' 不對mysqld的導入導出做限制
解決方法 :
我是不想進行限制,所以解決方法就是在mysql配置文件中添加secure_file_priv=' '
1、 打開windows的my.ini文件,我的版本mysql8.0,配置文件路徑:C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
2、 在my.ini文件 [mysqld]節點 下添加secure_file_priv=''
3、 重啟mysql8.0服務
再次執行導出語句即可。