MySQL WorkBench importing GeoIp in CSV

Not much mention of this working. alot of the info on the net is out of date. Importing CSV is possible through WorkBench.


DROP TABLE IF EXISTS location;
CREATE TABLE location(
locId int(10) unsigned NOT NULL,
country char(2) NOT NULL,
region char(2) NOT NULL,
city varchar(50),
postalCode char(5) NOT NULL,
latitude float,
longitude float,
dmaCode integer,
areaCode integer,
PRIMARY KEY (locId)
);

LOAD DATA LOCAL INFILE '/my/local/location/of/file/GeoLiteCity_20110301/GeoLiteCity-Location.csv'
INTO TABLE location
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '\"'
LINES TERMINATED BY '\n';

Be the first to comment

Leave a Reply

Your email address will not be published.


*