返回顶部

一缕半夏微光

温柔半两,从容一生

导航

java.sql.SQLException: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement的解决办法

今天在写程序的时候,需要从数据库中导出一些数据,然后就遇到了这个java.sql.SQLException: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement问题。

解决办法如下:

首先,我们打开cmd,查看一下secure-file-priv 当前的值是什么

先进入到mysql,命令为:mysql -hlocalhost -uroot -p

然后再输入命令:show variables like '%secure%';

很明显,我的这个导出路径是在C盘,我将导出数据的路径修改为C:\ProgramData\MySQL\MySQL Server 5.7\Uploads\后,就可以成功导出数据了

如果不想存放在C盘的话,可以修改my.ini文件里面的路径,改为自己想要的路径即可。

posted on 2021-11-27 14:39  一缕半夏微光  阅读(879)  评论(0编辑  收藏  举报