1.select into outfile导出
mysql> select * from tb_route_rule into outfile '/home/ocssm/usm/mysqldata-8.0.16/tmp/tb_route_rule.sql' fields terminated by '|' lines terminated by '\r\n';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
查看变量:
mysql> show global variables like '%secure%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_auth | ON |
| **secure_file_priv | NULL** |
+------------------+-------+
2 rows in set (0.00 sec)
secure_file_priv为null 表示不允许导入导出
secure_file_priv指定文件夹时,表示mysql的导入导出只能发生在指定的文件夹
secure_file_priv没有设置时,则表示没有任何限制
可在配置文件my.cnf中指定secure-file-priv路径,指定路径后导入导出的文件只能存放与该文件夹下: