下面有二種超級簡單的mysql命令,可以直接導出csv格式的數據,有需要的朋友可以參考一下,我推薦直接利用phpmyadmin操作。
代碼如下
復制代碼
select * from test_info
into outfile '/tmp/test.csv'
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by 'rn';
MySQL中導入CSV格式數據:
代碼如下
復制代碼
load data infile '/tmp/test.csv'
into table test_info
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by 'rn';