DreamHost Mysql CSV Import of IP2LOCATION geolocation datasets

I’ve been working on mapping the internet using a multi threaded python program that scans for open port 80 across the entire internet. I’ve built this front end to the system here.

http://search.shawnmccombs.com/

https://github.com/smccombs/InternetScavenger

I also built a screen scrapper for a website that geolocates IP addresses to use in my mapping but after a few requests the website blocks me (Screen scrapper code is in the same GitHub.)

https://geoiptool.com/

I did some research and found about 7 websites that sell these geolocation data-sets for $50-$5000 depending what all you want. Two of the sites have free data-sets. Free is all I can afford so I’ve downloaded them and started working on uploading them to my webhost Dreamhost.

http://lite.ip2location.com/database-ip-country-region-city-latitude-longitude-zipcode-timezone

It would be simple if Dreamhost would all you to “Load Data INFILE” but they will not. Because their mysql servers are separate form their file hosts. Meaning mysql does not have access to your sites files. In order to bypass this issue we have to covert the csv from IP2LOCATION to a .sql insert file. Then run it from command prompt to get the best import speed.

Here you will find the steps and code involved in converting the csv file and upload it to your databases.

https://github.com/smccombs/InternetScavenger/blob/master/IP2LOCATION-LITE-DB11.php

I hope this helps someone else with dreamhost issues also.

Please follow and like us: