mysql into outfile导出数据的时候出现错误: The MySQL server is running with the --secure-file-priv option so i

今天尝试使用 into outfile导出数据的时候出现错误:

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

上网查了一下,应该是mysql设置的权限的问题。

1:登录mysql,使用命令:show variables like '%secure%';,查看 secure-file-priv 当前的值是什么

mysql into outfile导出数据的时候出现错误: The MySQL server is running with the --secure-file-priv option so i

 

导出的数据必须是这个值的指定路径才可以导出,默认有可能是NULL就代表禁止导出,所以需要设置一下。

2:修改mysql安装路径下的my.ini文件,设置一下路径:

mysql into outfile导出数据的时候出现错误: The MySQL server is running with the --secure-file-priv option so i

 

要注意设置目录的权限

3:然后重启数据库即可;