IP Address Geolocation From MySQL

Want to support HowtoForge? Become a subscriber!
 
Submitted by marchost (Contact Author) (Forums) on Tue, 2009-02-10 11:10. :: Linux | MySQL

IP Address Geolocation From MySQL

In this short tutorial I will use a local MySQL database to do IP addresses geolocation.

First download the database from this page: http://blogama.org/node/58

And then go in your favorite MySQL interface and type:

SELECT * FROM `ip_group_city` where `ip_start` <= 4881709 order by ip_start desc limit 1;

IP addresses use this format (example IP A.B.C.D):

ip = (A*256+B)*256+C

For example, if you have an ip of 74.125.45.100 (Google):

It would become in the database:

ip = (74*256+125)*256+45 = 4881709


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by China Wholesale (not registered) on Tue, 2009-08-04 08:56.
I will use a local MySQL database to do IP addresses geolocation.
Submitted by Anonymous (not registered) on Sun, 2009-08-02 10:40.
How does the database compare to those commercial providers such as http://www.ip2location.com/ which are currently using by banks and government?
Submitted by amzul (not registered) on Fri, 2009-06-26 08:10.

hey Marc thanks for your work.

can you please specify a way on how to use your rsync server?

  rsync --verbose --progress --stats --update rsync://rsync.ipinfodb.com/ipinfodb /tmp/downloads/sql/

i can see that there are some files but cant synchronized them.

 

thanks 

Submitted by Anonymous (not registered) on Tue, 2009-06-16 13:51.
I found a new site to check out IP Address details through
http://www.ipaddressgeolocation.com
Submitted by Anonymous (not registered) on Thu, 2009-05-21 05:32.

 Hai,

It is nice way to know the ip address location through my sql.I like this.

But i got information about the ip address from this http://www.ip-details.com/ only.It is also very helpful for me.It contains more information about this ip address.

Submitted by micie (not registered) on Sat, 2009-02-14 20:25.

How accurate it is? As the IP locator: http://www.ip-adress.com


If yes, i will give it a try.

Submitted by marchost (registered user) on Mon, 2009-02-16 15:32.

Hi, the data is very accurate, around 99.8% accuracy. I updated it monthly.

Marc

Submitted by IT Magazines (not registered) on Tue, 2009-05-12 03:23.
Are you sure about the accuracy?
Submitted by Anonymous (not registered) on Mon, 2009-06-01 14:16.
Best site for IP Geo Location for me is www.myiptest.com