MySQL list countries/cities

I’m looking for a countries/cities (all over the world) MySQL dump.

Like they use in

I’ve searched for days, but cannot find it, who can help me (and many others) ??

This can be a good start…


This is a database we (a big bunch of hispanic coders from made a few months ago.

It includes 18 countries with COUNTRY/STATE/CITY structure, including Argentina, Colombia, Mexico, Brazil, US, Canada, and 12 more from Latin America.

I got a MySQL database with every country in the world. No cities, though. Let me know if you want it still.

Toly, if possible, can you hook me up?

Well, I knew I had something somewhere…

I found in one backup CD a CSV file with almost 7000 cities from 232 countries. I’m not saying I made it, but I don’t remember where I got it…


Actually those are states, not cities in most cases

Where the H… is my attachment, does anybody see it?

it has to be validated first by the mods :slight_smile:

Oh, I should imagine…

Hey! look, I’m a Zealot now!! :slight_smile:


They are in english and spanish, but you can just delete the spanish column.

Cheers man, you rock.

Apparantly I’m not the only one searching for this database. I already have the countries, that’s not a problem, but I want a complete database, like (as said on startpost):

Hey brain,

Just wait for my attachment to validate. It has a CVS with what you need.

manoloweb >> I can’t wait !!!

Finally there it is :wink:

Where ??

See post #5 in this thread

Super !!! thanx

Does anyone have a good trick how to convert to MySQL??

You’ll have to edit it to suit your server etc. but this should be a starting point for you


//-- Put your code to open a DB connection here

//-- make sure the cities.csv file is in the same directory as this script
$listing = file("cities.csv", "r");

        foreach ($listing as $line){

            $parts = explode(";", $line);

            //-- This makes the SQL in the form of
            /*   INSERT INTO `cities` ('Caracas', 've', '.Venezuela ');    */
            $sql = "INSERT INTO `cities` ('$parts[2]', '$parts[3]', '$parts[4]')"

            //-- Run the query

            //-- Echo some stuff to tell you what's going on
            echo 'Writing : '.$sql.'<br />';


Check The main cities database contains more than 1,800,000 from around the world, but if you want only cities in some countries or in some US states, you can ask for a customized db.

Hope that helps.