Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Shapefile to Mysql error using ogr2ogr

$
0
0

I’m following this tutorial. I installed the “GDAL Complete” Framework from kyngchaos.com and I tested the installation on Mac. I have GDAL 1.11.2, released 2015/02/10.

When I am trying to run this command:

ogr2ogr -f MySQL MySQL:dbname,user=root,password=password 
      -nln world_borders -nlt MULTIPOLYGON 
      -update -overwrite 
      -lco ENGINE=MyISAM 
      -lco MYSQL_FID=ogr_fid -lco GEOMETRY_NAME=geometry 
      /path/to/TM_WORLD_BORDERS-0.3.shp

With my settings it would be:

ogr2ogr -f MySQL MySQL:mapas,user=xxxx,password=xxxx 
      -nln test -nlt MULTIPOLYGON 
      -update -overwrite 
      -lco ENGINE=MyISAM 
      -lco MYSQL_FID=ogr_fid -lco GEOMETRY_NAME=geometry 
      /Users/Seph/Downloads/TM_WORLD_BORDERS-0.3/TM_WORLD_BORDERS-0.3.shp

I got this error:

Unable to find driver `MySQL'.
The following drivers are available:
-> `ESRI Shapefile'
-> `MapInfo File'
-> `UK .NTF'
-> `SDTS'
-> `TIGER'
-> `S57'
-> `DGN'
-> `VRT'
-> `REC'

I have created the table on my database before running the command.

UPDATE
I installed Homebrew I and ran this command:

brew install gdal --with-mysql

Now I have the supported format: -> “MySQL” (read/write)

But now I have this error:

Macbook-pro:~ Seph$ ogr2ogr -f MySQL MySQL:mapas,user=xxxx,password=xxxx
      -nln test -nlt MULTIPOLYGON 
      -update -overwrite 
      -lco ENGINE=MyISAM 
      -lco MYSQL_FID=ogr_fid -lco GEOMETRY_NAME=geometry 
       /Users/Seph/Downloads/TM_WORLD_BORDERS-0.3/TM_WORLD_BORDERS-0.3.shp
      ERROR 1: MySQL connect failed for: mapas,user=xxxx,password=xxxx
      Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
      ERROR 1: MySQL connect failed for: mapas,user=xxxx,password=xxxx
      Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
      ERROR 1: MySQL connect failed for: mapas,user=xxxx,password=xxxx
      Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
      ERROR 1: MySQL driver doesn't currently support database creation.
      Please create database before using.
      MySQL driver failed to create MySQL:mapas,user=xxxx,password=xxxx

I am using phpMyAdmin from Xammp


Viewing all articles
Browse latest Browse all 397

Trending Articles