首先查询mysql 导出指定的路径,使用命令

    show variables like '%secure%'; 

比如我的查询结果为

Variable_name       Value
secure_auth       ON
secure_file_priv      /var/lib/mysql-files/

那么应该使用路径 /var/lib/mysql-files/

例如:

SELECT a.dic_id, a.`name`, a.`value`, a.state, a.order_num FROM (
SELECT dic_id, `name`, `value`, state, order_num FROM tbl_dict_item WHERE dic_id ='res_level'
UNION SELECT dic_id, `name`, `value`, state, order_num FROM tbl_dict_item WHERE dic_id ='res_4'
UNION SELECT dic_id, `name`, `value`, state, order_num FROM tbl_dict_item WHERE dic_id ='res_2'
UNION SELECT dic_id, `name`, `value`, state, order_num FROM tbl_dict_item WHERE dic_id ='res_5'
UNION SELECT dic_id, `name`, `value`, state, order_num FROM tbl_dict_item WHERE dic_id ='res_11'
UNION SELECT dic_id, `name`, `value`, state, order_num FROM tbl_dict_item WHERE dic_id ='res_6') a
INTO OUTFILE '/var/lib/mysql-files/aa.sql';

 

导入使用命令:

load data local infile "/var/lib/mysql-files/aa.sql" into table tbl_dict_item character set utf8;

 

posted on 2019-05-23 15:07  慕筱优  阅读(506)  评论(0编辑  收藏  举报