QMYSQL mac os x yosemite

  • I had installed qt5 (qtcreator) and after that mysql (using homebrew). I got an issue: QMYSQL driver not loaded (only the QSQLITE driver is available). Someone can show me hot to fix it please??

    thank you

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You probably have the client libraries version 18 or upper and the MySQL plugin linked to a different version. The quickest way is to use otool to change the path from the MySQL plugin to point to your homebrew installed MySQL. Otherwise, you can re-build the plugin following Qt's documentation

  • Hi thank you to reply,
    I try that you meant like this:

    install_name_tool -change libqsqlmysql.dylib Qt/5.3/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib /usr/local/lib/libmysqlclient.dylib

    The command didn't return any error, so it's seem like working....Ithought. But I got the same problem.

  • Lifetime Qt Champion

    What's the output of otool -L libqsqlmysql.dylib ?

    [edit: corrected typo]

  • @SGaist said:

    otool -L libqsqlmysql.lib

    didn't work:

    *error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: libqsqlmysql.lib (No such file or directory)

  • Lifetime Qt Champion

    Either run it in the same folder where the plugin can be found or give the full path to libqsqlmysql.dylib

  • @SGaist said:

    Either run it in the same folder where the plugin can be found or give the full path

    libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /Users/ibrahimdie/Qt/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.0, current version 5.3.1)
    /Users/ibrahimdie/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.1)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

  • Lifetime Qt Champion

    That looks fine. What error does QSqlDatabase return ?

  • Actually I didn't have /opt/local/lib/mysql55 subdir, I created it, and I cp from /usr/local/lib/ the libmysqlclient.18.dyib on it (cf: line3). What line 2 means : C version 0.0.0, current version 0.0.0?

    what error does QSqlDatabase return?
    Here you are:
    DriverType: QMYSQL
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE
    Parameter 'DriverType' is invalid or RDB client library not available.

  • Lifetime Qt Champion

    You should have updated /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib to match your homebrew path

  • Thank you very much. Everything works now.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.