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

QSqlDatabase: QMYSQL3 driver not loaded?

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 3 Posters 4.0k Views 2 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.
  • J Offline
    J Offline
    jdent
    wrote on last edited by
    #1

    Hi,
    I am running the sqlbrowser example project, which connects fine with SQLITE but not with MYSQL. I get this error:

    QSqlDatabase: QMYSQL3 driver not loaded

    What could be going on?

    Thanks
    Juan

    the_T 1 Reply Last reply
    0
    • J jdent

      Hi,
      I am running the sqlbrowser example project, which connects fine with SQLITE but not with MYSQL. I get this error:

      QSqlDatabase: QMYSQL3 driver not loaded

      What could be going on?

      Thanks
      Juan

      the_T Offline
      the_T Offline
      the_
      wrote on last edited by
      #2

      @jdent
      Hi,

      which version of QT are you using?
      For Qt5.5 i dont know a QMYSQL3 driver. Do you mean QMYSQL?

      -- No support in PM --

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jdent
        wrote on last edited by
        #3

        I am using Qt 5.5.1 and I get same error whether I choose QMYSQL or QMYQL3..

        I modified the *.pro by adding:

        wince {
        DEPLOYMENT_PLUGIN += qsqlite
        # JDH added next
        DEPLOYMENT_PLUGIN += mysql
        }
        to no avail...

        ?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jdent
          wrote on last edited by
          #4

          Sorry, a mistake. Correct modification to *.pro is:

          wince {
          DEPLOYMENT_PLUGIN += qsqlite
          # JDH added next
          DEPLOYMENT_PLUGIN += qmysql
          }

          the_T 1 Reply Last reply
          0
          • J jdent

            Sorry, a mistake. Correct modification to *.pro is:

            wince {
            DEPLOYMENT_PLUGIN += qsqlite
            # JDH added next
            DEPLOYMENT_PLUGIN += qmysql
            }

            the_T Offline
            the_T Offline
            the_
            wrote on last edited by
            #5

            @jdent said:

            Sorry, a mistake. Correct modification to *.pro is:

            wince {
            DEPLOYMENT_PLUGIN += qsqlite
            # JDH added next
            DEPLOYMENT_PLUGIN += qmysql
            }
            Did you add

            QT += sql
            

            in your pro file?
            QT SQL

            -- No support in PM --

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jdent
              wrote on last edited by
              #6

              Did the change suggested but error is the same....

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

                Hi,

                Do you have the MySQL client library installed ?

                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
                • J Offline
                  J Offline
                  jdent
                  wrote on last edited by
                  #8

                  Well, I see the files libqsqlmysql.dylib and libqsqlmysql_debug.dylib in the folder ~/Qt5.5.1/5.5/clang_64/plugins/sqldrivers so I guess it is installed??

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

                    No, those are the Qt plugins. You need to verify that your OS has the MySQL client libraries installed.

                    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
                    • J Offline
                      J Offline
                      jdent
                      wrote on last edited by
                      #10

                      Well I can run Mysql workbench correctly... does not that mean the client tools are installed?

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

                        No, it does not. Are you running 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
                        • J Offline
                          J Offline
                          jdent
                          wrote on last edited by
                          #12

                          YES OS X 10.11.3

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

                            Then unless you installed it using brew/macports or the official MySQL package. You won't have the client library.

                            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
                            • J Offline
                              J Offline
                              jdent
                              wrote on last edited by
                              #14

                              how can I ensure that I have the client libraries?

                              1 Reply Last reply
                              0
                              • J Offline
                                J Offline
                                jdent
                                wrote on last edited by
                                #15

                                Hi,

                                I apologise for making a question that probably should be answered by MySQL web site but I have not found any answer .. maybe someone that has a lot of experience with MySql can find it very easy to direct my attention to where I can figure out if the client library is available. Does it need to be in a PATH or another environment variable? Do I place that in bash_profile or bashrc?

                                I downloaded the mysql-connector-c-6.1.6-osx10.8-x86_64 source and it has the following libraries in the lib subdir:

                                libmysqlclient.a
                                libmysqlclient.dylib
                                libmysqlclient.18.dylib
                                libmysqlclient_r.a
                                libmysqlclient_r.dylib
                                libmysqlclient_r.18.dylib

                                How do I put them so Qt Creator will find them? These ARE the client libraries right?

                                Thanks again!!
                                Juan

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

                                  Yes, these are the client libraries.

                                  Now run otool -L path/to/qsqlmysql.dylib. You will get the list of dependencies of the plugin with an entry concerning the MySQL client library. You will have to run install_name_tool -change current/path/to/client_library your/path/to/client/library qsqlmysql.dylib

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

                                  J 1 Reply Last reply
                                  0
                                  • SGaistS SGaist

                                    Yes, these are the client libraries.

                                    Now run otool -L path/to/qsqlmysql.dylib. You will get the list of dependencies of the plugin with an entry concerning the MySQL client library. You will have to run install_name_tool -change current/path/to/client_library your/path/to/client/library qsqlmysql.dylib

                                    J Offline
                                    J Offline
                                    jdent
                                    wrote on last edited by jdent
                                    #17

                                    @SGaist Your help, once again!!! I am deeply grateful...
                                    Problem solved!!

                                    Juan

                                    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