MYSQL数据导出与导入,secure_file_priv参数设置

1. Mysql数据导出到Mysql默认路径:

1)首先查看mysql导出的默认路径,如下命令:
show variables like '%secure%';
secure_file_priv:对应的路径即为默认路径

2)导出某个数据库的表的所有数据为某种格式,例如:csv格式:

    SELECT * from user_tbl into outfile '/var/lib/mysql-files/test-hu1.xlsx'

2.将数据导出到指定路径,则需要修改默认路径,若没有修改配置文件,

在进行数据导出的时候出现:

secure-file-priv option so it cannot execute this statement

此时,需要修改:

/etc/mysql/mysql.conf.d/mysqld.cnf 文件,如图

在末尾添加一句secure_file_priv=”/”即可将数据导出到任意目录

 MYSQL数据导出与导入,secure_file_priv参数设置

原文链接:https://blog.csdn.net/HHTNAN/article/details/78520511

不过:修改配置文件这种方式,本人尝试并未成功!!!!