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

    今天在用mysql命令导出数据时出现The MySQL server is running with the --secure-file-priv option so it cannot execute this statement,网上百度了下,原因是mysql在文件导入导出方面权限问题

    接下来说一说我的解决办法,首先找到安装mysql的目录文件,在根目录下找到' my.ini '文件并用txt文件格式打开,再在文件中搜索”secure-file-priv“,接下来修改其值,例如:secure-file-priv=D:\\mysql-8.0.11-winx64\\outfile,这样就好了。

    说明一下,修改到这个目录是对mysql导入导出文件的目录进行了约束,也就是说导入导出目录要在此目录下进行。当然你也可以讲其值设为secure-file-priv='',这样就可以在任意目录下对mysql数据进行导入导出了。

    下面说一下,修改完成之后要重启mysql服务了(这里介绍win10)。

    方式一:右击开始菜单->任务管理器->服务->mysql。右击mysql重启服务即可。

    方式二:

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