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. Unable to connect to Mysql on Mac
QtWS25 Last Chance

Unable to connect to Mysql on Mac

Scheduled Pinned Locked Moved Installation and Deployment
20 Posts 2 Posters 6.3k 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.
  • F Offline
    F Offline
    fuji256
    wrote on last edited by
    #1

    I've searched a lot for a nice new Development Tool and was just so happy to find Qt. But now it seems impossible to get it work properly.

    Since days i've tried to successfully connect to my mysql server, the driver in plugin/sqldrivers/ is around but not loaded in the example application sql browser.

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

    I've tried to copy existing libs to project folder ect. and rebuilding the driver, which doesn't work since the file-linkages are severely messed up, seems to be from a different directory-tree-structure. All the tips i found were on older versions or different os.
    I'm using Qt 5.2 and OSx 10.7

    Desperate and very thankful for any advice what to do to get the example running on osx !!

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

      Hi and welcome to devnet,

      Did you install MySQL for OS X ?

      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
      • F Offline
        F Offline
        fuji256
        wrote on last edited by
        #3

        Yes, server and connector up and running, latest builds.

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

          what does otool -L on libqsqlmysql.dylib return ?

          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
          • F Offline
            F Offline
            fuji256
            wrote on last edited by
            #5

            Allready checked, all covered in the specific places. But for the record…

            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/**/Qt/5.2.0/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.2.0, current version 5.2.0)

            /Users/**/Qt/5.2.0/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.0)

            /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)

            Thnx a lot!

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

              Then what error does QSqlDatabase return ?

              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
              • F Offline
                F Offline
                fuji256
                wrote on last edited by
                #7

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

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

                  Sorry, I meant the QSqlDatabase::error function

                  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
                  • F Offline
                    F Offline
                    fuji256
                    wrote on last edited by
                    #9

                    QSqlError.text is "Driver not loaded"… not sure that's what you meant.

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

                      Yes that's it but I was hoping for more information since you have the plugin that seems to be built correctly.

                      Did you build it yourself ?

                      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
                      • F Offline
                        F Offline
                        fuji256
                        wrote on last edited by
                        #11

                        Not yet, because it didn't work at all. I thought it evt. could work since it comes in the package… however. I'm trying to build it again. After downgrading my server to mysql 5.5 version and adjusting the suggested links from the program internal help I'm stuck again:
                        qsql_mysql.o only in 32bit but it automatically tries to build in 64bit clang…

                        omg

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

                          Are you trying to build the plugin in 32 bit ? Qt's in 64 bit by default

                          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
                          • F Offline
                            F Offline
                            fuji256
                            wrote on last edited by
                            #13

                            It tries to build in 64 with clang 64, but it claims qsql_mysql.o coming with Qt src is only 32bit and stops building because of that…

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

                              How did you install Qt ?

                              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
                              • F Offline
                                F Offline
                                fuji256
                                wrote on last edited by
                                #15

                                Hello again.
                                Now i managed to build the plugin successfully with latest versions.
                                But still the sample sqlbrowser doesn't load the driver.

                                I also checkt all dependencies and tried having a copy of the driver libqsqlmysql.dylib and libqsqlmysql_debug.dylib as well as libmysqlclient.18.dylib to the project folder.

                                desperate again… a big thnx for any hints in advance!!

                                1 Reply Last reply
                                0
                                • F Offline
                                  F Offline
                                  fuji256
                                  wrote on last edited by
                                  #16

                                  I'm working on osX 10.8.5, Qt Creator 3.01 (based on Qt 5.2.1 clang-64)
                                  the driver is based on the same version src for sql-drivers and mysql 5.6.17 (x86_64) also properly working with workbench on localhost…

                                  the only thing could be that libmysqlclient.18.dylib wasn't built with clang-64. but how to solve that? the linker worked properly.

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

                                    They must not be in the same folder as the application. Qt looks for the plugins in specific folders. What you must ensure is that llibqsqlmysql can get to libmysqlclient what does otool -L on both libraries return ?

                                    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
                                    • F Offline
                                      F Offline
                                      fuji256
                                      wrote on last edited by
                                      #18

                                      Of course, putting them in the same folder as the project was an act of desperation. The links i've checked and all seemed fine to me - i found all the required files in pace.
                                      The output of otool -L for libmysqlclient and libqsqlmysql in the clang_64/plugins/sqlservers folder:

                                      libmysqlclient.18.dylib:
                                      libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
                                      /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
                                      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

                                      libqsqlmysql.dylib:
                                      libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
                                      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/br/Qt521/5.2.1/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.2.0, current version 5.2.1)
                                      /Users/br/Qt521/5.2.1/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.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)

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

                                        The id of libmysqlclient.18.dylib is just libmysqlclient.18.dylib so you either need to add the path containing that lib to DYLD_LIBRARY_PATH or update the id to use the full path to it.

                                        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
                                        • F Offline
                                          F Offline
                                          fuji256
                                          wrote on last edited by
                                          #20

                                          You're my hero of the week!!
                                          Thanks a lot!
                                          b

                                          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