MYSQL INTO OUTFILE, LOAD DATA INFILE

来源:互联网 发布:二叉排序树算法java 编辑:程序博客网 时间:2024/05/19 02:05
INTO OUTFILE,  LOAD DATA INFILE mysql> select * from test into outfile '/tmp/1.txt';Query OK, 1000000 rows affected (0.65 sec)mysql> truncate table test; Query OK, 0 rows affected (0.00 sec)mysql> load data infile '/tmp/1.txt' into table test;Query OK, 1000000 rows affected (6.50 sec)Records: 1000000  Deleted: 0  Skipped: 0  Warnings: 0mysql>  select count(*) from test;+----------+| count(*) |+----------+|  1000000 | +----------+1 row in set (0.32 sec)


导出为有格式的CSV文件


 

mysql> select * from test into outfile '/tmp/1.csv' fields enclosed by '"' terminated by ',' lines terminated by '\r\n';Query OK, 1000000 rows affected (0.61 sec)


 

0 0