如何将数据从csv加载到mysql

时间:2013-05-15 21:43:51

标签: mysql csv mysqldump

因此csv文件的结构如下:

Country,City,AccentCity,Region,Population,Latitude, 
ad,aixas,Aixàs,06,,42.4833333,1.4666667
ad,aixirivali,Aixirivali,06,,42.4666667,1.5
ad,aixirivall,Aixirivall,06,,42.4666667,1.5
ad,aixirvall,Aixirvall,06,,42.4666667,1.5

问题在于我不知道如何构建Load数据查询,我的意思是使用哪些分隔符等等,mabe你们可以帮我一个有效的例子。

1 个答案:

答案 0 :(得分:0)

这对你有帮助吗?

load data local infile 'myfile.csv' into table myTable fields terminated by ','
lines terminated by '\n'
(Country,City,AccentCity,Region,Population,Latitude)