Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
mysql > LOAD DATA LOCAL INFILE 'FILE-PATH-TO\\\\dbip-city-lite-####-##.csv' INTO TABLE ip2location_db3
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\rn'
IGNORE 1 ROWS 
(@ip_from,@ip_to,@continent_code,country_code,region_name,city_name,latitude,longitude)
SET country_name = (SELECT country_name from country_list where ip2location_db3.country_code = country_list.country_code), ip_to from= INET_ATON(@ip_tofrom), ip_fromto=INET_ATON(@ip_fromto);

* replace "FILE-PATH-TO" with the actual file path where the downloaded file has been saved and the '#' with the year and month that appends the file name.

Image RemovedImage Added

Please note that it can take about 30 a. few minutes minutes to import the data.Image Removed

6 - You can check the table has been uploaded properly by selecting the first few rows..

Code Block
languagesql
mysql >  select * from ip2location_db3 Limit 100;

Image Added