MYSQL导入数据出现The MySQL server is running with the --secure-file-priv

时间:2021-11-15 13:37:29

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

方法一:

这个原因其实很简单,是因为在安装MySQL的时候限制了导入与导出的目录权限

只能在规定的目录下才能导入

我们需要通过下面命令查看 secure-file-priv 当前的值是什么

show variables like '%secure%';

MYSQL导入数据出现The MySQL server is running with the --secure-file-priv

我们可以看到value的值为/var/lib/mysql-files/

那么我们把导入的路径改为上面的值就可以了

方法二:

如果觉得这样太麻烦,那么我们就需要改配置文件,找到my.ini配置文件,修改路径,重启