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. Mac --> QSqlDatabase: QMYSQL driver not loaded
Forum Updated to NodeBB v4.3 + New Features

Mac --> QSqlDatabase: QMYSQL driver not loaded

Scheduled Pinned Locked Moved Installation and Deployment
33 Posts 3 Posters 13.3k 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
    #22

    Ok ! Here we have it now. Please use install_name_tool to update the QtSql library in the framework

    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
    • N Offline
      N Offline
      NicoKino
      wrote on last edited by
      #23

      In my folder I have theses files :
      @bash-3.2$ cd usr/local/mysql-5.6.19-osx10.6-x86//lib/
      bash-3.2$ ls
      libmysqlclient.18.dylib libmysqlclient_r.dylib
      libmysqlclient.a libmysqld-debug.a
      libmysqlclient.dylib libmysqld.a
      libmysqlclient_r.18.dylib libmysqlservices.a
      libmysqlclient_r.a plugin@

      What will I do ?

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

        using install_name_tool, correct the path /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib in libqsqlmysql.dylib with /usr/local/mysql-5.6.19-osx10.6-x86//lib/libmysqlclient.18.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
        • N Offline
          N Offline
          NicoKino
          wrote on last edited by
          #25

          When I'm in the correct directory, what lines I must insert in the terminal ?

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

            install_name_tool -change old_path new_path libqsqlmysql.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
            • W Offline
              W Offline
              warcomeb
              wrote on last edited by
              #27

              Hello SGaist,
              I have tried your solution, with this instruction:
              install_name_tool -change /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib /Applications/mampstack-5.4.26-0/mysql/lib/libmysqlclient.dylib libqsqlmysql.dylib

              but during debug I receive this message:
              @
              QFactoryLoader::QFactoryLoader() checking directory path "/Users/warcomeb/Projects/build-LabOrToolGui-Desktop_Qt_5_2_1_clang_64bit/Debug/LabOrTool.app/Contents/MacOS/sqldrivers" ...
              loaded library "/Users/warcomeb/Qt5.2.1/5.2.1/clang_64/plugins/sqldrivers/libqsqlmysql.dylib"
              QSqlError(-1, "", "")
              Database non connected!
              QSqlError(2005, "QMYSQL: Unable to connect", "Unknown MySQL server host 'localhost:3306' (2)") @

              I have followed all step that you wrote previously!
              Can you help me?

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

                Is your server running ?

                Also, if it was deployed correctly, you should need to correct the path by hand. The client library should be already copied in your bundle

                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
                • W Offline
                  W Offline
                  warcomeb
                  wrote on last edited by
                  #29

                  Yes, the server is running!
                  I have added setPort to my database configuration and now it work!

                  Thanks!
                  Marco

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    NicoKino
                    wrote on last edited by
                    #30

                    It's not work for my :'(

                    @install_name_tool -change /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib /Applications/mampstack-5.4.26-0/mysql/lib/libmysqlclient.dylib libqsqlmysql.dylib
                    error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: can't open file: libqsqlmysql.dylib (No such file or directory)
                    @

                    what I must to do ? I'm on Yosemite now.

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

                      As silly as it may sound, use the correct path to libqsqlmysql.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
                      • N Offline
                        N Offline
                        NicoKino
                        wrote on last edited by
                        #32

                        I don't understand what you mean.

                        One other thing when I run my project I have these lines :
                        @QSqlDatabase: QMYSQL driver not loaded
                        QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7@

                        If it's available why it's not loaded.

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

                          @can't open file: libqsqlmysql.dylib (No such file or directory)@

                          You didn't run the command in the right folder since libqsqlmysql.dylib could not be found.

                          That generally happens when the plugin can't be loaded because e.g. it can't find one of the its dependencies

                          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

                          • Login

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