給自己做備份的,高手們請忽略。 
數據太大,用數據庫客戶端軟件直接導入非常卡,還是直接執行SQL吧。 
1、指定文件路徑。 
2、字段之間以逗號分隔,數據行之間以/r/n分隔(我這里文件是以/n分隔的)。 
3、字符串以半角雙引號包圍,字符串本身的雙引號用兩個雙引號表示。 
Sql代碼 
復制代碼 代碼如下:
 
load data infile 'D://top-1m.csv' 
into table `site` 
fields terminated by ',' optionally enclosed by '"' escaped by '"' 
lines terminated by '/n'; 
復制代碼 代碼如下:
 
select * from `site` 
into outfile 'D://top-1m.csv' 
fields terminated by ',' optionally enclosed by '"' escaped by '"' 
lines terminated by '/n'; 
新聞熱點
疑難解答