I cannot load a vector layer from MySQL in QGIS 2.10 (Pisa) on a Mac. If I goto Layer -> Add Layer -> Add Vector Layer -> Database I do not see MySQL in the drop down.
I found this link. I did not go through all the steps in that answer. Rather I jumped to step 6 where it says to run ogrinfo --formats
. This is what I got:
$ ogrinfo
dyld: Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.18.dylib
Referenced from: /usr/local/bin/ogrinfo
Reason: image not found
Trace/BPT trap: 5
After some mucking around I found that I already have a similar file at:
$ ls /usr/local/mysql/lib
libmysqlclient.20.dylib libmysqld-debug.a mecab
libmysqlclient.a libmysqld.a pkgconfig
libmysqlclient.dylib libmysqlservices.a plugin
I had installed MySQL from a DMG file if that helps. I copied all these files recursively to /usr/local/opt/mysql/lib
and also renamed libmysqlclient.20.dylib
to linmysqlclient.18.lib
to end up with following:
$ ls /usr/local/opt/mysql/lib
libmysqlclient.18.dylib libmysqld-debug.a mecab
libmysqlclient.a libmysqld.a pkgconfig
libmysqlclient.dylib libmysqlservices.a plugin
Now I get:
$ ogrinfo --formats | grep 'MySQL'
-> "MySQL" (read/write)
But Step 7 of the answer does not work as expected:
>>> from osgeo import ogr
>>> sorted([ogr.GetDriver(drv).name for drv in range(0,ogr.GetDriverCount())])
['ARCGEN', 'AVCBin', 'AVCE00', 'AeronavFAA', 'BNA', 'CSV', 'CartoDB', 'CouchDB', 'DGN', 'DODS', 'DXF', 'EDIGEO', 'ESRI Shapefile', 'ElasticSearch', 'GFT', 'GME', 'GML', 'GMT', 'GPKG', 'GPSBabel', 'GPSTrackMaker', 'GPX', 'GeoJSON', 'GeoRSS', 'Geoconcept', 'Geomedia', 'HTF', 'Idrisi', 'Interlis 1', 'Interlis 2', 'KML', 'LIBKML', 'MSSQLSpatial', 'MapInfo File', 'Memory', 'NAS', 'ODBC', 'ODS', 'OGDI', 'OSM', 'OpenAir', 'OpenFileGDB', 'PCIDSK', 'PDS', 'PGDump', 'PGeo', 'PostgreSQL', 'REC', 'S57', 'SDTS', 'SEGUKOOA', 'SEGY', 'SOSI', 'SQLite', 'SUA', 'SVG', 'SXF', 'TIGER', 'UK .NTF', 'VFK', 'VRT', 'WAsP', 'WFS', 'Walk', 'XLS', 'XLSX', 'XPlane']
MySQL is not listed in above. What am I missing here? Tried running QGIS again and don't see MySQL in the drop down. Any help?
I have also tried copying mysqlclient.20.lib
to /Library/Application\ Support/GDAL/1.11/PlugIns/
with no success.