MySQL导入导出CSV格式

来自linux中国网wiki
Evan讨论 | 贡献2021年10月29日 (五) 08:01的版本 (创建页面,内容为“=table= <pre> 针对 单个table menu MariaDB [mycmdb]> SELECT * INTO OUTFILE "/tmp/out.csv" FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' FRO…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

table

针对 单个table  menu
MariaDB [mycmdb]> SELECT * INTO OUTFILE "/tmp/out.csv" FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'   FROM menu;
Query OK, 31 rows affected (0.014 sec)

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