zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

mysql导出数据报错The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

2023-09-11 14:19:37 时间

MySQL导出文件时,遇到报错“The MySQL server is running with the --secure-file-priv option so it cannot execute this statement”,网上搜索解决方案,各大神方案相同,

第一步:show variables like '%secure%';

图一

第二步:打开MySQL安装路径,找到my.ini配置文件,搜索 secure,

图二:找到这里,修改路径(原来的最好是注释掉,不要删除),

重启MySQL服务, 就能正常导出到修改后的路径了,但是我依然失败了,报错还是“The MySQL server is running with the --secure-file-priv option so it cannot execute this statement”,又看了几篇博客,都是一样的思路,问题应该出在我自己身上了,自己检查了操作流程,终于找到了原因,修改路径时,由于嫌手动输入路径麻烦,我是直接复制的路径,从下图里复制的路径:
图三:

 

导出时用的也是这个路径,加上一个文件名,结果就是继续报错,

(注意斜杠)

图一、图三显示的是反斜杠,我复制的路径也是用的反斜杠,但是图二配置文件中,用的是斜杠,我导出的文件路径用的也是反斜杠,因此导致失败,把图二中修改的路径改成斜杠,导出路径也用斜杠,导出成功!希望其他小伙伴不要再犯同样的错误!

 

 

转 :https://blog.csdn.net/qq_34172340/article/details/83870035

https://blog.csdn.net/zhuyunier/article/details/88707634