[FWTools] ogr2ogr with MySQL

Mateusz Loskot mateusz at loskot.net
Fri Oct 13 09:02:30 EDT 2006

Mateusz Loskot wrote:
>> However, I'm curious why OGR from FWTools does not work for you.
>> If I won't forget, during the weekend, I'll try to test FWTools on
>> my Windows XP machine.


I think I've found where is the problem.
For MySQL, you need to specify -update option for ogr2ogr.
It instructs OGR to open existing data store in update mode,
instead of creating new data store.
The -update option is required on both platforms, Linux and Windows.

So, correct command example should look like this:

1. Create 'world' database

2. Import world_borders.shp layer

C:\data\world>ogr2ogr -f MySQL MySQL:world,user=mloskot -nln borders
world_borders.shp -lco SPATIAL_INDEX=NO -update

I tested it with success on MySQL 5.0.22 on Linux
and 5.0.24 on Windows XP.

Best regards
Mateusz Loskot

More information about the FWTools mailing list