所以我试图将geoipcity数据导入到我的表中,如下所示:
mysqlimport --fields-terminated-by="," --fields-optionally-enclosed-by="\"" --lines-terminated-by="\n" --host=localhost --user=user --password=passw database_name /var/www/html/GeoLiteCity_20150804/geoip_city.csv
但我一直收到错误。
Error: 1062, Duplicate entry '0' for key 'PRIMARY'
现在我已经看过有关此错误的问题,但我根本不理解答案。我不是一个大师,我是一个志愿者IT人员,我不知道如何解决这个问题。我尝试使用它:
LOAD DATA LOCAL INFILE '/var/www/html/GeoLiteCity_20150804/geoip_city_ips.csv' INTO TABLE geoip_city_ips;
然后它只会用" NULL"填充表格。在所有栏目中。
我的表结构:
--
geoip_city
CREATE TABLE IF NOT NOT EXISTS geoip_city
(
locID
int(10)unsigned NOT NULL,
country
char(8)COLLATE utf8_unicode_ci DEFAULT NULL,
region
char(8)COLLATE utf8_unicode_ci DEFAULT NULL,
city
varchar(255)COLLATE utf8_unicode_ci DEFAULT NULL,
postalCode
char(32)CHARACTER SET latin1 DEFAULT NULL,
latitude
double DEFAULT NULL,
longitude
double DEFAULT NULL,
dmaCode
char(8)CHARACTER SET latin1 DEFAULT NULL,
areaCode
char(8)CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY(locID
),
KEY Index_Country
(country
)
)ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = FIXED;
来自geoip_city的一些行:
717543," MX"" 32""萨卡特卡斯"" 98051",22.7833,-102.5833 ,, 717544," MX"" 26""卡纳内阿"" 84624",30.9500,-110.3000 ,, 717545," MX"" 07"" Valles的"" 79040",26.6667,-100.6833 ,, 717546," DE"" 02""伯格"" 88276",47.9667,11.3500 ,, 717547," DE"" 09"" Schwalbach的"" 65824",49.3000,6.8167 ,, 717548," RU"" 48""莫斯科"" 129233",55.7522,37.6156 ,, 717549," MX"" 28""雷诺萨"" 88520",26.0833,-98.2833 ,, 717550," PH"," 40"," San Jose"," 5100",12.4558,121.0459 ,, 717551," ES"" 56""塔拉戈纳"" 43070",41.1167,1.2500 ,, 717552," GB"" Z6""""",51.9167,-0.6500 ,,
答案 0 :(得分:0)
嗯,我猜这是一个MariaDB问题,因为没有人回复?会回到Debian解决问题吗?