现在的位置: 首页 > 综合 > 正文

mysql 导出 csv数据命令

2013年08月16日 ⁄ 综合 ⁄ 共 294字 ⁄ 字号 评论关闭

导出

select field1,field2,field3 from tablename into outfile '/home/output1.csv' fields terminated by ','optionally enclosed by ''lines terminated by '/n';

 

导入

load data local infile '/home/output1.csv' into table tablename fields terminated by ','lines terminated by '/n'(field1,field2,field3);

 

注意:

1.写文件的目标目录需要是mysql拥有写权限的目录。

抱歉!评论已关闭.