So I'm trying to import geoipcity data into my table like so:
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
But I keep getting the error.
Error: 1062, Duplicate entry '0' for key 'PRIMARY'
Now I saw the question relating to this error has been asked before but I simply don't understand the answers. I'm not that much of a guru, I'm a volunteer IT guy and I have no idea how to resolve this. I tried using this instead:
LOAD DATA LOCAL INFILE '/var/www/html/GeoLiteCity_20150804/geoip_city_ips.csv' INTO TABLE geoip_city_ips;
But then it would simply fill the table with "NULL" in all the columns.
My table structure:
--
-- Table structure for table geoip_city
CREATE TABLE IF 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;
Some lines from geoip_city:
717543,"MX","32","Zacatecas","98051",22.7833,-102.5833,, 717544,"MX","26","Cananea","84624",30.9500,-110.3000,, 717545,"MX","07","Valles","79040",26.6667,-100.6833,, 717546,"DE","02","Berg","88276",47.9667,11.3500,, 717547,"DE","09","Schwalbach","65824",49.3000,6.8167,, 717548,"RU","48","Moscow","129233",55.7522,37.6156,, 717549,"MX","28","Reynosa","88520",26.0833,-98.2833,, 717550,"PH","40","San Jose","5100",12.4558,121.0459,, 717551,"ES","56","Tarragona","43070",41.1167,1.2500,, 717552,"GB","Z6","","",51.9167,-0.6500,,
Well I'm guessing this is a MariaDB issue then since nobody replied? Would going back to Debian solve the issue?