如何在MySQL中创建数据库以导入Maxmind GeoLite2 city csv

如何在MySQL中创建数据库以导入Maxmind GeoLite2 city csv,mysql,sql,maxmind,geolite2,geolitecity,Mysql,Sql,Maxmind,Geolite2,Geolitecity,如何在MySQL中创建数据库以导入Maxmind GeoLite2 city csv? 我需要知道我必须使用哪些类型的字段,以及如何正确连接数据库中的表以从csv文件导入 这是我的SQL代码示例: DROP TABLE IF EXISTS location; CREATE TABLE IF NOT EXISTS `location` ( `geoname_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `locale_code` varchar(2)

如何在MySQL中创建数据库以导入Maxmind GeoLite2 city csv?

我需要知道我必须使用哪些类型的字段,以及如何正确连接数据库中的表以从csv文件导入

这是我的SQL代码示例:

DROP TABLE IF EXISTS location;

CREATE TABLE IF NOT EXISTS `location` (
`geoname_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`locale_code` varchar(2) DEFAULT NULL, 
`continent_code` varchar(2) DEFAULT NULL,
`continent_name` varchar(20) DEFAULT NULL,
`country_iso_code` varchar(2) DEFAULT NULL,
`country_name` varchar(50) DEFAULT NULL,
`subdivision_1_iso_code` varchar(20) DEFAULT NULL, 
`subdivision_1_name` varchar(70) DEFAULT NULL,
`subdivision_2_iso_code` varchar(20) DEFAULT NULL, 
`subdivision_2_name` varchar(70) DEFAULT NULL,
`city_name` varchar(100) DEFAULT NULL,
`metro_code` int(11) DEFAULT NULL,
`time_zone` varchar(100) DEFAULT NULL,
PRIMARY KEY (`geoname_id`)
)   ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS blocks_IPv4;

CREATE TABLE `blocks_IPv4` (
`network` varchar(30) DEFAULT NULL,
`geoname_id` int(11) DEFAULT NULL,
`registered_country_geoname_id` int(11) DEFAULT NULL,
`represented_country_geoname_id` int(11) DEFAULT NULL,
`is_anonymous_proxy` tinyint(1) DEFAULT '0',
`is_satellite_provider` tinyint(1) DEFAULT '0',
`postal_code` varchar(45) DEFAULT NULL,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
`accuracy_radius` INT(5)
)   ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS blocks_IPv6;

CREATE TABLE `blocks_IPv6` (
`network` varchar(255) DEFAULT NULL, 
`geoname_id` int(11) DEFAULT NULL,
`registered_country_geoname_id` int(11) DEFAULT NULL,
`represented_country_geoname_id` int(11) DEFAULT NULL,
`is_anonymous_proxy` tinyint(1) DEFAULT '0',
`is_satellite_provider` tinyint(1) DEFAULT '0',
`postal_code` varchar(45) DEFAULT NULL,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
`accuracy_radius` INT(5)
)    ENGINE=InnoDB DEFAULT CHARSET=utf8;