1. 程式人生 > >將csv匯入到mysql資料表中

將csv匯入到mysql資料表中

看了網上的很多程式碼,試了很多都沒用。所以決定自己寫個。

示例:load data local infile "E:/book1.csv" into table `monster`.`c_monstermodel` character set GBK fields terminated by ',' enclosed by '"' lines terminated by '\r\n';

"E:/book1.csv"是csv絕對路徑。

 `monster`.`c_monstermodel` 中,monster是資料庫名,c_monstermodel是資料表名。

character set GBK 設定編碼格式