Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMYSQL driver not loaded..
Qt 6.11 is out! See what's new in the release blog

QMYSQL driver not loaded..

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 3 Posters 4.0k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Where is your libmysqlclient.XX.dylib file located on your machine ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    1
    • TheCipo76T Offline
      TheCipo76T Offline
      TheCipo76
      wrote on last edited by
      #5

      @SGaist said in QMYSQL driver not loaded..:

      libmysqlclient.XX.dylib

      i found "libmysqlclient.20.dylib" in:

      /opt/local/lib/mysql57/mysql/

      folder

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #6

        Then fix that path using install_name_tool

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • TheCipo76T Offline
          TheCipo76T Offline
          TheCipo76
          wrote on last edited by
          #7

          i can't fix it..

          i try with

          0_1536758727291_Schermata 2018-09-12 alle 15.23.08.png

          but no solutions..

          where is the problem??

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #8

            What are you trying to modify libmysqlclient.20.dylib ?

            It's the plugin that you should update.

            Note that the entry ending with 0tz# doesn't make any sense.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • TheCipo76T Offline
              TheCipo76T Offline
              TheCipo76
              wrote on last edited by TheCipo76
              #9

              how can i update the plugin???

              i havo to use install_name_tool?

              sorry but i'm beginner with Qt

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #10

                Yes, that's the tool.

                It has nothing to do with Qt. It's macOS library management. If you search the forum a bit, you can find many threads about the same topic.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • TheCipo76T Offline
                  TheCipo76T Offline
                  TheCipo76
                  wrote on last edited by
                  #11

                  @TheCipo76 said in QMYSQL driver not loaded..:

                  /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/0tz#

                  i don't understand what i have to do with install_name_tool

                  how can i update plugin??

                  i've tried some times but i can't find the right way..

                  install_name_tool -change /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/0tz#  /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers /opt/local/lib/mysql57/mysql/libqsqlmysql.dylib
                  

                  give me this error..

                  error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: /opt/local/lib/mysql57/mysql/libqsqlmysql.dylib (No such file or directory)

                  can you help me please?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    That error is pretty clear: there's no libqsqlmysql.dylib in /opt/local/lib/mysql57/mysql/ which is normal since that's a Qt plugin and it has nothing to do in the MySQL install folder.

                    Did you even tried to read the documentation of install_name_tool ?

                    install_name_tool -change old new input :

                    • old is the old path you want to change
                    • new is the path which you want to use in place of old
                    • input is either a library or an application where you want to do the modification.

                    Note that both old and new are path to libraries.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • TheCipo76T Offline
                      TheCipo76T Offline
                      TheCipo76
                      wrote on last edited by
                      #13

                      hi, yes i read man page before try .. but i can't solve..

                      i've tried with:

                      install_name_tool -change /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/0tz#  /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
                      

                      but the path is the same..

                      this is the console message:

                      QFactoryLoader::QFactoryLoader() checking directory path "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers" ...
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/0tz#"
                      QMachOParser: '/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/0tz#' is not a valid Mach-O binary (file too small)
                      "'/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/0tz#' is not a valid Mach-O binary (file too small)" 
                               not a plugin
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib"
                      Found metadata in lib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QSQLITE"
                              ]
                          },
                          "className": "QSQLiteDriverPlugin",
                          "debug": false,
                          "version": 330498
                      }
                      
                      
                      Got keys from plugin meta data ("QSQLITE")
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"
                      Found metadata in lib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QSQLITE"
                              ]
                          },
                          "className": "QSQLiteDriverPlugin",
                          "debug": true,
                          "version": 330498
                      }
                      
                      
                      Got keys from plugin meta data ("QSQLITE")
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
                      Found metadata in lib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QMYSQL3",
                                  "QMYSQL"
                              ]
                          },
                          "className": "QMYSQLDriverPlugin",
                          "debug": false,
                          "version": 330498
                      }
                      
                      
                      Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
                      Found metadata in lib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QMYSQL3",
                                  "QMYSQL"
                              ]
                          },
                          "className": "QMYSQLDriverPlugin",
                          "debug": true,
                          "version": 330498
                      }
                      
                      
                      Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib"
                      Found metadata in lib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QPSQL7",
                                  "QPSQL"
                              ]
                          },
                          "className": "QPSQLDriverPlugin",
                          "debug": false,
                          "version": 330498
                      }
                      
                      
                      Got keys from plugin meta data ("QPSQL7", "QPSQL")
                      QFactoryLoader::QFactoryLoader() looking at "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib"
                      Found metadata in lib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                          "MetaData": {
                              "Keys": [
                                  "QPSQL7",
                                  "QPSQL"
                              ]
                          },
                          "className": "QPSQLDriverPlugin",
                          "debug": true,
                          "version": 330498
                      }
                      
                      
                      Got keys from plugin meta data ("QPSQL7", "QPSQL")
                      QFactoryLoader::QFactoryLoader() checking directory path "/Users/matteo/Desktop/C++/QT/EasyGest/build-EasyGest-Desktop_Qt_5_11_2_clang_64bit18-Debug/EasyGest.app/Contents/MacOS/sqldrivers" ...
                      Cannot load library /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
                        Referenced from: /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
                        Reason: image not found)
                      QLibraryPrivate::loadPlugin failed on "/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib" : "Cannot load library /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: (dlopen(/Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, 133): Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib\n  Referenced from: /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib\n  Reason: image not found)"
                      QSqlDatabase: QMYSQL driver not loaded
                      QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                      

                      where is the problem this time??

                      why the only plugin with problems is the one i need and the other's seem to be ok??

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #14

                        Again that's wrong. This is a list of libraries and where you can find them, you are trying to change that for just a folder so it won't work.

                        Re-run otool -Lon the plugin to see the exact list.

                        As for MySQL:

                        install_name_tool -change /usr/local/mysql/lib/libmysqlclient.20.dylib /opt/local/lib/mysql57/mysql/libmysqlclient.20.dylib /Users/matteo/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • TheCipo76T Offline
                          TheCipo76T Offline
                          TheCipo76
                          wrote on last edited by
                          #15

                          Ok, finally work!

                          Thank you for patience and constancy you've used with me.

                          1 Reply Last reply
                          0
                          • Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #16

                            @TheCipo76 said in QMYSQL driver not loaded..:

                            Ok, finally work!

                            Can you please make the thread as solved then? Thx.

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            1 Reply Last reply
                            0
                            • TheCipo76T Offline
                              TheCipo76T Offline
                              TheCipo76
                              wrote on last edited by
                              #17

                              i've installed Qt in another mac and i've the same problem

                              i run otool -L and this is reply:

                              libqsqlmysql.dylib:
                              	libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
                              	@rpath/QtSql.framework/Versions/5/QtSql (compatibility version 5.11.0, current version 5.11.2)
                              	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.11.0, current version 5.11.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)
                              	/usr/local/mysql/lib/libmysqlclient.21.dylib (compatibility version 20.0.0, current version 20.0.0)
                              	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
                              	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
                              

                              i've checked the path and it's OK (fixed with install_name_tool -change...)

                              when i run my App (with QT_DEBUG_PLUGINS set to 1)
                              i've this debug result:

                              QFactoryLoader::QFactoryLoader() checking directory path "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers" ...
                              QFactoryLoader::QFactoryLoader() looking at "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib"
                              Found metadata in lib /Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QSQLITE"
                                      ]
                                  },
                                  "className": "QSQLiteDriverPlugin",
                                  "debug": false,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QSQLITE")
                              QFactoryLoader::QFactoryLoader() looking at "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib"
                              Found metadata in lib /Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlite_debug.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QSQLITE"
                                      ]
                                  },
                                  "className": "QSQLiteDriverPlugin",
                                  "debug": true,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QSQLITE")
                              QFactoryLoader::QFactoryLoader() looking at "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
                              Found metadata in lib /Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QMYSQL3",
                                          "QMYSQL"
                                      ]
                                  },
                                  "className": "QMYSQLDriverPlugin",
                                  "debug": false,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                              QFactoryLoader::QFactoryLoader() looking at "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib"
                              Found metadata in lib /Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlmysql_debug.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QMYSQL3",
                                          "QMYSQL"
                                      ]
                                  },
                                  "className": "QMYSQLDriverPlugin",
                                  "debug": true,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QMYSQL3", "QMYSQL")
                              QFactoryLoader::QFactoryLoader() looking at "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib"
                              Found metadata in lib /Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QPSQL7",
                                          "QPSQL"
                                      ]
                                  },
                                  "className": "QPSQLDriverPlugin",
                                  "debug": false,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QPSQL7", "QPSQL")
                              QFactoryLoader::QFactoryLoader() looking at "/Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib"
                              Found metadata in lib /Users/matteomissora/Qt/5.11.2/clang_64/plugins/sqldrivers/libqsqlpsql_debug.dylib, metadata=
                              {
                                  "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                                  "MetaData": {
                                      "Keys": [
                                          "QPSQL7",
                                          "QPSQL"
                                      ]
                                  },
                                  "className": "QPSQLDriverPlugin",
                                  "debug": true,
                                  "version": 330498
                              }
                              
                              
                              Got keys from plugin meta data ("QPSQL7", "QPSQL")
                              QFactoryLoader::QFactoryLoader() checking directory path "/Users/matteomissora/build-EasyGest-Desktop_Qt_5_11_2_clang_64bit18-Debug/EasyGest.app/Contents/MacOS/sqldrivers" ...
                              QSqlDatabase: MYSQL driver not loaded
                              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
                              

                              why don't work?

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #18

                                Because you have a type: it's QMYSQL you only wrote MYSQL.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • TheCipo76T Offline
                                  TheCipo76T Offline
                                  TheCipo76
                                  wrote on last edited by
                                  #19

                                  i missed..
                                  i didn' see it..
                                  Thank you..

                                  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