
Learn how to import GeoIP and GeoLite CSV format databases into popular SQL
database platforms.

<!-- prettier-ignore-start -->

### Guides


- heading: "PostgreSQL"
  url: "/geoip/importing-databases/postgresql"
  text: "Import databases to PostgreSQL."
- heading: "MySQL"
  url: "/geoip/importing-databases/mysql"
  text: "Import databases to MySQL."


<!-- prettier-ignore-end -->

## [Importing GeoIP and GeoLite databases to MySQL](/geoip/importing-databases/mysql/)
> **⚠️ Warning**
> 


On Wednesday, November 27, 2024 we updated this tutorial to address an issue in
which some IPv4 and IPv6 addresses could overlap. If you used a version of this
tutorial prior to that date, please consult the updated instructions for
querying the data in the following sections below:

- [Test our table by querying it](#test-our-table-by-querying-it)
- [Order the table for faster searching](#order-the-table-for-faster-searching)
- [Break up our query for faster searching](#break-up-our-query-for-faster-searching)


<p>This guide will show you how to import GeoIP or GeoLite databases into MySQL so
that they can be easily queried and manipulated on your server.</p>

## [Importing GeoIP and GeoLite databases to PostgreSQL](/geoip/importing-databases/postgresql/)
<p>This guide will show you how to import GeoIP or GeoLite databases into
PostgreSQL so that they can be easily queried and manipulated on your server.</p>
<p>Importing a CSV database consists of downloading the database, extracting it,
creating tables to hold the data, and indexing those tables for faster querying.</p>
## Download and extract the database
<p>Begin by making sure you have downloaded the latest version of the GeoIP or
GeoLite database that you want to import. You can
[download databases through your account portal](https://www.maxmind.com/en/accounts/current/geoip/downloads).
CSV format databases are shipped as a single zip file. See our CSV database
documentation for details about the zip structure and contents of the archive.
For the purposes of this tutorial, we will be using the
[GeoIP City CSV file](/geoip/docs/databases/city-and-country/#csv-databases),
but you can get information about
[any of our CSV format databases](/geoip/docs/databases) and adapt the following
instructions accordingly.</p>

