Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

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

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 1 Posters 368 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • worldpieceW Offline
    worldpieceW Offline
    worldpiece
    wrote on last edited by worldpiece
    #1

    hi,I have the same problem with MacOs X (Mojave) :
    I'm trying to sift through the many and aging recommendations of how to successfully build a mysql driver for Qt.
    emm.."然并卵" !_!

    step 1 :

    /Users/ing/Qt5.14.2/5.14.2/clang_64/bin/qmake -- MYSQL_PREFIX=/usr/local/mysql
    

    results:

    Running configuration tests...
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
    DB2 (IBM) .............................. no
    InterBase .............................. no
    MySql .................................. yes
    OCI (Oracle) ........................... no
    ODBC ................................... no
    PostgreSQL ............................. no
    SQLite2 ................................ no
    SQLite ................................. yes
    Using system provided SQLite ......... no
    TDS (Sybase) ........................... no
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/Users/ing/Qt5.14.2/5.14.2/clang_64'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    step 2 :

    **otool -L libqsqlmysql.dylib**
    

    results:

    libqsqlmysql.dylib:
    libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/QtSql.framework/Versions/5/QtSql (compatibility version 5.14.0, current version 5.14.2)
    @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.14.0, current version 5.14.2)
    /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    @rpath/libmysqlclient.21.dylib (compatibility version 21.0.0, current version 21.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
    

    step 3:

    install_name_tool -change /usr/local/mysql/lib/libmysqlclient.21.dylib @rpath/libmysqlclient.21.dylib /Users/ing/Qt5.14.2/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
    
    install_name_tool -change /usr/local/mysql/lib/libmysqlclient.21.dylib /usr/local/mysql-8.0.20-macos10.15-x86_64/lib/libmysqlclient.21.dylib
     /Users/ing/Qt5.14.2/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
    

    Emm...but still :

    10:24:16: Starting /Users/ing/Documents/learn/qt/build-QtMysql-Desktop_Qt_5_14_2_clang_64bit-Debug/QtMysql.app/Contents/MacOS/QtMysql ...
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    10:24:20: /Users/ing/Documents/learn/qt/build-QtMysql-Desktop_Qt_5_14_2_clang_64bit-Debug/QtMysql.app/Contents/MacOS/QtMysql exited with code 0
    

    Related configuration:

    #bash_profile:
    #Setting PATH for qmake
    export QTDIR=/Users/ing/Qt5.14.2/5.14.2/clang_64
    export QT_DEBUG_PLUGINS=1
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
    export PATH=$QTDIR/bin:$PATH
    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/mysql/lib
    

    Have spent a day on this,help!! ths very much!

    1 Reply Last reply
    0
    • worldpieceW Offline
      worldpieceW Offline
      worldpiece
      wrote on last edited by worldpiece
      #2

      @worldpiece said in QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7:

      install_name_tool -change /usr/local/mysql/lib/libmysqlclient.21.dylib @rpath/libmysqlclient.21.dylib /Users/ing/Qt5.14.2/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib

      Found the problem -- step3 :
      change

      install_name_tool -change /usr/local/mysql/lib/libmysqlclient.21.dylib @rpath/libmysqlclient.21.dylib /Users/ing/Qt5.14.2/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
      
      

      to

      install_name_tool -change @rpath/libmysqlclient.21.dylib /usr/local/mysql/lib/libmysqlclient.21.dylib   /Users/ing/Qt5.14.2/5.14.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
      

      solved!

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved