MySQL导入导出CSV格式
跳到导航
跳到搜索
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) -- 这里写你的sql 语句 select * from myUser into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n'; #一个例子 use system; select id,old_id,old_supplier_id,product_type,name,sales_platform,corporate_entity,insurancid from product where add_time < 16350 and supplier_id = 0 and old_id > 0 and deleted_at is null into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';