Error Code: 1290. The MySQL server is running with the --secure-file-priv option

我用的是phstudy 2016,php-5.4.45+Apache 的集成环境,在将查询结果导入到文件是时候,提示   Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement. 刚开始还以为是路径的问题,后来换了路径也不行,用 show variables like '%secure_file_priv%' 查了一下 secure-file-priv 的value是NULL

Error Code: 1290. The MySQL server is running with the --secure-file-priv option

Error Code: 1290. The MySQL server is running with the --secure-file-priv option

找到配置文件mysql.ini,在my.ini中加入secure-file-priv=“c:/phpstudy/Mysql” (即你想让文件导出的位置)

Error Code: 1290. The MySQL server is running with the --secure-file-priv option

然后再用 outfile 导出文件成功~

Error Code: 1290. The MySQL server is running with the --secure-file-priv option

在自己指定的文件位置查询,可查到导出结果~ 哈哈~

Error Code: 1290. The MySQL server is running with the --secure-file-priv option