Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- cd /tmp
- curl -O http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum2.zip
- unzip GeoIPASNum2.zip
- */
- drop table if exists geoipasn;
- CREATE TABLE geoipasn (
- i1 INT(10) UNSIGNED NULL primary key,
- i2 INT(10) UNSIGNED NULL,
- asn INT(10) UNSIGNED default convert (replace(substring_index(asname,' ',1),'AS',''),unsigned),
- asname varchar(100) NULL,
- index asn(asn)
- )
- ENGINE=MyISAM;
- truncate table geoipasn;
- load data infile '/tmp/GeoIPASNum2.csv' into table geoipasn
- FIELDS TERMINATED BY ','
- OPTIONALLY ENCLOSED BY '"'
- LINES TERMINATED BY '\n'
- (i1,i2,asname);
- optimize table geoipasn;
- -- select asn,asname,sum(1)n,sum(i2-i1+1)ips from geoipasn group by asn with rollup;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement