您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

mysql --secure_file_priv的设置

bubuko 2022/1/25 20:06:10 mysql 字数 1495 阅读 862 来源 http://www.bubuko.com/infolist-5-1.html

最近常需要将大表导出为csv格式,在使用select into outfile xxx的时候,就会出现此报错。 [Code: 1290, SQL State: HY000] The MySQL server is running with the –secure file priv option s ...

最近常需要将大表导出为csv格式,在使用select * into outfile xxx的时候,就会出现此报错。
?

[Code: 1290, SQL State: HY000] The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

?
这时候可以先检查这个参数的值,在mysql数据库中输入以下命令:

show variables like ‘%secure_file_priv%’;

?
然后就可以看到:
?
技术分享图片

默认的路径是/var/lib/mysql-files

如果要想修改此路径的话,只能通过修改启动时添加特定参数或者修改配置文件后重启服务来实现。

?

  1. 启动时添加特定参数。可通过mysqld -secure-file-priv=xxx来实现。
    ?

  2. 修改配置文件后重启。可以在mysql配置文件中mysqld选项下添加参数**secure-file-priv来实现。

?
其中,如果:
secure_file_priv=null 不允许csv文件的导入导出
?
secure_file_priv=xxx csv文件导入导出到某路径
?
secure_file_priv=/ csv文件可导入到任意路径

mysql --secure_file_priv的设置

原文:https://www.cnblogs.com/young233/p/12469780.html


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶