下面有二種超級簡單的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';
還有一種方法,就是用phpmyadmin的有同學都知道,它帶有一個直接導出excel和csv的功能哦,那種更方法哦。