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.

enter image description here

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.

3 Answers 3


You've to reinstall mysql and ogrinfo package to fix the broken dependencies, e.g.

brew reinstall mysql ogrinfo

Also make sure you're not overriding any DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH or DYLD_FRAMEWORK_PATH variables from the startup shell scripts (e.g. ~/.bash_profile).


After following all the steps in this answer (except that I did not edit any files as in step 4 and I used gdal-1.11.3) I was able to get past this issue but ran into a new problem. I see the mysql dropdown now but when I try to connect to a db I get a segmentation fault EXC_BAD_ACCESS (SIGSEGV)


While researching this issue I found this:http://osgeo-org.1560.x6.nabble.com/MySQL-support-Qgis-on-Mac-td5215360.html Which may be the answer if one is using kyngchaos on OS X

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.