2014年4月18日 星期五

MySQL import from csv

LOAD DATA LOCAL INFILE '/tmp/bar.csv' INTO TABLE `foo` CHARACTER SET UTF8 FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

* windows 檔案需用 '\r\n'


ERROR 1148 (42000): The used command is not allowed with this MySQL version
LOAD DATA INFILE '/tmp/bar.csv' INTO TABLE `foo` CHARACTER SET UTF8 FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

沒有留言:

張貼留言