您的位置:首页 > 数据库 > MySQL

mysql导入导出csv文件

2016-05-09 20:46 901 查看

mysql导出csv文件

语法块

`select block`
into outfile `/path/of/file`
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';


例子

select * from test_info
into outfile '/tmp/test.csv'
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';


mysql导入csv文件

语法块

load data infile '/path/of/file'
into table `/name/of/table`
fields terminated by ','  optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';


例子

load data infile '/tmp/test.csv'
into table test_info
fields terminated by ','  optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: