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

mysql 导入导出csv命令

2016-11-07 17:03 274 查看
导出

select * from test_info
into outfile '/tmp/test.csv'
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';


如果是远程连接mysql,可能会报错,可以试试 load data local infile …..

如果使用工具的话,一般更简单,比如使用navicat , workbench等

workbench可参考官方文档:

https://dev.mysql.com/doc/workbench/en/wb-admin-export-import-table.html

http://www.jianshu.com/p/d330edb61fe2

http://blog.csdn.net/sara_yhl/article/details/6850107
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: