MySql数据库导出csv文件命令
MySql数据库导出csv文件命令:
MySql数据库导出csv文件命令: mysql> select first_name,last_name,email from account into outfile 'e://output1.csv' fields terminated by ','optionally enclosed by ''lines terminated by '/n'; csv文件效果: sunny Grigoryan lovechoosesun@gmail.com Jon Siegal sun@riliantech.net Joe Siegal zhao@gmail.com alejandro medina wei@gmail.com cvs文件导入MySql数据库命令: mysql> load data local infile 'e://input1.csv' into table test1 fields termin ated by ','lines terminated by '/n'(first_name,last_name,email); Query OK, 1 row affected, 1 warning (0.00 sec) Records: 69 Deleted: 0 Skipped: 68 Warnings: 0 mysql> select * from test1; +----+------------+-----------+--------------------------+ | id | first_name | last_name | email | +----+------------+-----------+--------------------------+ | 0 | sunny | Grigoryan | lovechoosesun@gmail.com +----+------------+-----------+--------------------------+ FIELDS TERMINATED BY ---- 字段终止字符 OPTIONALLY ENCLOSED BY ---- 封套符 LINES TERMINATED BY ---- 行终止符
FROM: http://blog.csdn.net/lovechoose/article/details/5280509