Important: Please read the Qt Code of Conduct -

Completely lost trying to get QMYSQL working on OS X

  • QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

    this is the error I get when I run my application. I am on OS X. Installing SQL drivers appears to be a painful task and a poorly documented one. From the QT site:

    cd $QTDIR/src/plugins/sqldrivers/mysql
    qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r"

    $QTDIR is not only not defined, but this directory doesn't even exist. This is the closest I could find:


    And it is filled with dylibs for all the installed drivers.

    The instructions above on the QT website are confusing, I do not understand what I am supposed to do. Could anyone provide me with step by step instructions on how to get this driver working?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You need to first install Qt's sources, and then execute the qmake/make commands from there.

Log in to reply