Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMYSQL driver not loaded on MACos



  • Platform:
    Macos 10.14
    Mysql 8.0.17
    Qt 5.9.8

    Hi guys, when i run the code in qt creator it warns that

    0_1564715424624_屏幕快照 2019-08-02 11.10.13.png

    I followed the directions provided in the forum , but it still didn't work.
    when i run "-otool -L libqsqlmysql.dylib" , it shows

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: 'libqsqlmysql.dylib': No such file or directory
    

    actually i found that in the folder "/Users/edwinxxxx/Qt5.9.8/5.9.8/plugins/sqldrivers" there exists the file "libqsqlmysql.dylib" absolutely.

    and in "user/local/mysql/" i can find the file "libmysqlclient.21.lib"
    0_1564716134880_屏幕快照 2019-08-02 11.22.03.png

    so why i cant find any folder or file like "/opt/local/mysql55..." and "libmysqlclient.18.lib"?
    how can i run "install_name_tool" to make it connect?
    i have been upset for a long time.looking forward to your help.really big thx:)


  • Lifetime Qt Champion

    @edwinxxxx Use absolute path to libqsqlmysql.dylib

    otool -L /Users/edwinxxxx/Qt5.9.8/5.9.8/plugins/sqldrivers/libqsqlmysql.dylib
    

    If the driver can't be loaded then most probably MySQL client library is missing.
    What does

    ldd /Users/edwinxxxx/Qt5.9.8/5.9.8/plugins/sqldrivers/libqsqlmysql.dylib
    

    output?



  • @jsulm wow! i use the absolute path, so it works?
    0_1564722174289_屏幕快照 2019-08-02 13.02.08.png


Log in to reply