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
[email protected]
Jon
Siegal
[email protected]
Joe
Siegal
[email protected]
alejandro
medina
[email protected]
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 | [email protected]
+----+------------+-----------+--------------------------+
FIELDS TERMINATED BY ---- 字段终止字符
OPTIONALLY ENCLOSED BY ---- 封套符
LINES TERMINATED BY ---- 行终止符
MySQL数据导入导出csv文件命令
猜你喜欢
转载自whxhz.iteye.com/blog/1611626
今日推荐
周排行