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 on mac
Forum Updated to NodeBB v4.3 + New Features

QMYSQL driver not loaded on mac

Scheduled Pinned Locked Moved Solved General and Desktop
mysqlmac os xqt5.9.1
43 Posts 7 Posters 23.5k Views 3 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.
  • A Offline
    A Offline
    Amit Talbot
    wrote on last edited by
    #24

    im using qt 5.9 and isolated install on mysql 5.7.20 on mac this piece of code worked like charm for me

    brew install mysql-connector-c
    

    I already had MAMP installed.... and wanted to use the mysql from mamp running on port 8889 this code helped me to do that

    ```
    

    db.setHostName("localhost");
    db.setConnectOptions("UNIX_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock");
    db.setDatabaseName("xxxxxx");
    db.setUserName("root");
    db.setPassword("root");
    db.setPort(8889);

    1 Reply Last reply
    0
    • E Offline
      E Offline
      edwinxxxx
      wrote on last edited by edwinxxxx
      #25

      Hi, what i have done are as pervious.but it shows that

      //-bash: /Users/lucas/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: cannot execute binary file"
      

      how can i fix it? thx for your help:)

      jsulmJ 1 Reply Last reply
      0
      • E edwinxxxx

        Hi, what i have done are as pervious.but it shows that

        //-bash: /Users/lucas/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib: cannot execute binary file"
        

        how can i fix it? thx for your help:)

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #26

        @edwinxxxx said in QMYSQL driver not loaded on mac:

        /Users/lucas/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib

        You can't execute a library.
        What are you trying to do?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        E 1 Reply Last reply
        0
        • jsulmJ jsulm

          @edwinxxxx said in QMYSQL driver not loaded on mac:

          /Users/lucas/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib

          You can't execute a library.
          What are you trying to do?

          E Offline
          E Offline
          edwinxxxx
          wrote on last edited by edwinxxxx
          #27

          @jsulm coz mysql driver can't be loaded in qt creator , i followed the directions above which has been proved that it was a successful way to solve the problem.but error happens.

          jsulmJ 1 Reply Last reply
          0
          • E edwinxxxx

            @jsulm coz mysql driver can't be loaded in qt creator , i followed the directions above which has been proved that it was a successful way to solve the problem.but error happens.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #28

            @edwinxxxx Please tell us the exact step your executing when you get that error message

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 1 Reply Last reply
            0
            • jsulmJ jsulm

              @edwinxxxx Please tell us the exact step your executing when you get that error message

              E Offline
              E Offline
              edwinxxxx
              wrote on last edited by
              #29

              @jsulm 0_1564648798567_屏幕快照 2019-08-01 16.34.23.png

              jsulmJ 1 Reply Last reply
              0
              • E edwinxxxx

                @jsulm 0_1564648798567_屏幕快照 2019-08-01 16.34.23.png

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #30

                @edwinxxxx The last thig you did does not make sense: you're trying to execute a lib.
                The first one was not successful - you called it in a wrong way. Take a look at its output ("Usage:"), it explains how to call it.
                @SGaist - you're the Mac expert, can you take a look?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • E Offline
                  E Offline
                  edwinxxxx
                  wrote on last edited by
                  #31

                  @jsulm thanks for your tips.i have wasted the whole day to solve it😂

                  SGaistS 1 Reply Last reply
                  0
                  • E edwinxxxx

                    @jsulm thanks for your tips.i have wasted the whole day to solve it😂

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #32

                    @edwinxxxx so it's now working correctly ?

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

                    E 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      @edwinxxxx so it's now working correctly ?

                      E Offline
                      E Offline
                      edwinxxxx
                      wrote on last edited by edwinxxxx
                      #33

                      @sgaist
                      platform: macos 10.14
                      mysql 8.0.17
                      qt 5.9.8

                      firstly i run

                      //otool -L libqsqlmysql.dylib
                      

                      but it shows

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

                      how can i find the path like "opt/local..." on my machine?
                      thanks man.

                      jsulmJ 1 Reply Last reply
                      0
                      • E edwinxxxx

                        @sgaist
                        platform: macos 10.14
                        mysql 8.0.17
                        qt 5.9.8

                        firstly i run

                        //otool -L libqsqlmysql.dylib
                        

                        but it shows

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

                        how can i find the path like "opt/local..." on my machine?
                        thanks man.

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #34

                        @edwinxxxx said in QMYSQL driver not loaded on mac:

                        how can i find the path like "opt/local..." on my machine?

                        find / -name libqsqlmysql.dylib
                        

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        E 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @edwinxxxx said in QMYSQL driver not loaded on mac:

                          how can i find the path like "opt/local..." on my machine?

                          find / -name libqsqlmysql.dylib
                          
                          E Offline
                          E Offline
                          edwinxxxx
                          wrote on last edited by
                          #35

                          @jsulm sorry, i still cant find any folder whose name begin with "/opt/local..."

                          0_1564726030510_屏幕快照 2019-08-02 14.07.02.png

                          jsulmJ 1 Reply Last reply
                          0
                          • E edwinxxxx

                            @jsulm sorry, i still cant find any folder whose name begin with "/opt/local..."

                            0_1564726030510_屏幕快照 2019-08-02 14.07.02.png

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #36

                            @edwinxxxx "/opt" is a system folder just under root /

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            E 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @edwinxxxx "/opt" is a system folder just under root /

                              E Offline
                              E Offline
                              edwinxxxx
                              wrote on last edited by
                              #37

                              @jsulm is that mean i cant locate the file "libmysqlclient.xx.dylib" in my pc?

                              jsulmJ 1 Reply Last reply
                              0
                              • E edwinxxxx

                                @jsulm is that mean i cant locate the file "libmysqlclient.xx.dylib" in my pc?

                                jsulmJ Offline
                                jsulmJ Offline
                                jsulm
                                Lifetime Qt Champion
                                wrote on last edited by jsulm
                                #38

                                @edwinxxxx No, it doesn't mean that. If it is somewhere on your machine you can find it.
                                Where did you install it?
                                Did you try what I suggested?

                                find / -name libmysqlclient.*.dylib
                                

                                https://forum.qt.io/topic/113070/qt-code-of-conduct

                                E 1 Reply Last reply
                                0
                                • jsulmJ jsulm

                                  @edwinxxxx No, it doesn't mean that. If it is somewhere on your machine you can find it.
                                  Where did you install it?
                                  Did you try what I suggested?

                                  find / -name libmysqlclient.*.dylib
                                  
                                  E Offline
                                  E Offline
                                  edwinxxxx
                                  wrote on last edited by
                                  #39

                                  @jsulm Yes! it shows a lot of contents, and the related information is
                                  0_1564727625430_屏幕快照 2019-08-02 14.32.18.png

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • E edwinxxxx

                                    @jsulm Yes! it shows a lot of contents, and the related information is
                                    0_1564727625430_屏幕快照 2019-08-02 14.32.18.png

                                    jsulmJ Offline
                                    jsulmJ Offline
                                    jsulm
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #40

                                    @edwinxxxx So, it is in /usr/local, not /opt/local.

                                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • E Offline
                                      E Offline
                                      edwinxxxx
                                      wrote on last edited by edwinxxxx
                                      #41

                                      @jsulm when i call "otool -L " it indicates that

                                      libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
                                      	@rpath/QtSql.framework/Versions/5/QtSql (compatibility version 5.9.0, current version 5.9.8)
                                      	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.8)
                                      	/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.20.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)
                                      

                                      so according to other's experience i run

                                      install_name_tool -change/usr/local/mysql/lib/libmysqlclient.20.dylib/usr/local/mysql-8.0.17-macos10.14-x86_64/lib/libmysqlclient.21.dylib/Users/edwinxxxx/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
                                      

                                      however,it seems didn't work still.

                                      Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
                                      
                                      jsulmJ 1 Reply Last reply
                                      0
                                      • E edwinxxxx

                                        @jsulm when i call "otool -L " it indicates that

                                        libqsqlmysql.dylib (compatibility version 0.0.0, current version 0.0.0)
                                        	@rpath/QtSql.framework/Versions/5/QtSql (compatibility version 5.9.0, current version 5.9.8)
                                        	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.8)
                                        	/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.20.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)
                                        

                                        so according to other's experience i run

                                        install_name_tool -change/usr/local/mysql/lib/libmysqlclient.20.dylib/usr/local/mysql-8.0.17-macos10.14-x86_64/lib/libmysqlclient.21.dylib/Users/edwinxxxx/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib
                                        

                                        however,it seems didn't work still.

                                        Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input
                                        
                                        jsulmJ Offline
                                        jsulmJ Offline
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #42

                                        @edwinxxxx said in QMYSQL driver not loaded on mac:

                                        install_name_tool -change/usr/local/mysql/lib/libmysqlclient.20.dylib/usr/local/mysql-8.0.17-macos10.14-x86_64/lib/libmysqlclient.21.dylib/Users/edwinxxxx/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib

                                        I'm really not an MacOS expert, but don't you miss spaces here? Everything adter -change is one string without any separation via spaces.

                                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        E 1 Reply Last reply
                                        1
                                        • jsulmJ jsulm

                                          @edwinxxxx said in QMYSQL driver not loaded on mac:

                                          install_name_tool -change/usr/local/mysql/lib/libmysqlclient.20.dylib/usr/local/mysql-8.0.17-macos10.14-x86_64/lib/libmysqlclient.21.dylib/Users/edwinxxxx/Qt5.9.8/5.9.8/clang_64/plugins/sqldrivers/libqsqlmysql.dylib

                                          I'm really not an MacOS expert, but don't you miss spaces here? Everything adter -change is one string without any separation via spaces.

                                          E Offline
                                          E Offline
                                          edwinxxxx
                                          wrote on last edited by
                                          #43

                                          @jsulm woooow! i add the spaces and the error disappear!
                                          REALLY REALLY thanks!!!!

                                          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