MYSQL导出数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this

转载自

 MYSQL导出数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this - CSDN博客  https://blog.csdn.net/man_to_home/article/details/54947518

 

show variables like '%secure%';查看 secure-file-priv 当前的值是什么

MYSQL导出数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this

如上图所示,我设置的secure-file-priv值为D:/CoderLife/testMySQL,而 MySQL 默认的值为:

  • secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads"

我们可以通过打开my.ini配置文件进行查看及修改:

MYSQL导出数据出现The MySQL server is running with the --secure-file-priv option so it cannot execute this

如上图所示,我注释了 MySQL 的默认值,并修改成自己指定的路径。实际上,在我们修改此配置文件的内容之后,例如修改了secure-file-priv的默认值,要想使其生效,我们必须关闭 MySQL 然后重新启动。在这里,需要我们注意的是:关闭 MySQL 并不是指简单的用exit命令退出 MySQL 或者关闭 MySQL 窗口,而是关闭 MySQL 服务,然后重新启动服务。至于如何开启和关闭 MySQL 服务,具体可以参考