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

select from admin into outfile ‘d:/1.sql’ 导出文件到某路径,即在d盘生成一个1.sql文件
也可以 select ‘nihao’ into outfile ‘d:/1.sql’ 即只导出’nihao’。
如果执行命令时遇到了
The MySQL server is running with the –secure-file-priv option so it cannot execute this statement.
那么说明mysql设置下不允许库的导入或导出,先在cmd中查看查看
show variables like “secure%”
具体如下:
secure_file_prive=null 不允许有库的导入与导出
secure_file_priv=/
**/ 只允许导入与导出发生在***目录下
secure_file_priv= 不做任何限制
那么就要修改my.ini文件中的配置
一般情况下my.ini在安装目录下,是需要在安装mysql的时候用户自己创建的,
如果之前安装时未设置my.ini文件,参考安装mysql
打开my.ini文件,在第一行的
[mysqld]
后再起一行,写入
secure_file_priv=
即可。注意等号后面什么都不要加。

你可能感兴趣的:(The MySQL server is running with the –secure-file-priv option so it cannot execute this statement)