1. 从本地mysql数据库导出csv文件到本地文件:
select * from table into outfile '***' fields terminated by ',' optionally enclosed by
'' lines terminated by '/n';
实例:
<pre name="code" class="sql">select bread,height,weight from cluster into outfile 'F://cluster.csv' fields terminated by ',' optionally enclosed by '' lines terminated by '/n';
效果:mysql===>csv
2. 从本地导入csv数据到mysql数据库:
load data infile '***' into table *** fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\n';
实例:
load data infile 'F://cluster.csv' into table cluster fields terminated by ',' optionally enclosed '"' escaped by '"' lines terminated by '\n';