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. QMYSQL Driver not loaded but available
Qt 6.11 is out! See what's new in the release blog

QMYSQL Driver not loaded but available

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
18 Posts 4 Posters 5.8k 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.
  • S Offline
    S Offline
    SethTales
    wrote on last edited by
    #6

    I believe I am making progress. Found a good resource. Here's a more open-ended question: how would one know they needed to compile Qt from source code in order to use MySQL? It's definitely not spelled out anywhere in the documentation that I could find, and it's taken me the better part of a week (off and on) to troubleshoot it. Is this just a weird edge-case that doesn't happen often, or is the standard way that all development packages should be installed to ensure dependencies are met?

    JonBJ 1 Reply Last reply
    0
    • S Offline
      S Offline
      SethTales
      wrote on last edited by
      #7

      OK, I followed the instructions here and it looks like everything built correctly. However, when I now try to build the plugin in the terminal using:

      seth@seth-XPS-L521X:~/qt-everywhere-src-5.10.0/qtbase/plugins/sqldrivers$ qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
      

      I get the message:

      Cannot find file: mysql.pro.
      

      Thoughts?

      jsulmJ 1 Reply Last reply
      0
      • S SethTales

        OK, I followed the instructions here and it looks like everything built correctly. However, when I now try to build the plugin in the terminal using:

        seth@seth-XPS-L521X:~/qt-everywhere-src-5.10.0/qtbase/plugins/sqldrivers$ qmake "INCLUDEPATH+=/usr/include" "LIBS+=-L/usr/lib/mysql -lmysqlclient_r" mysql.pro
        

        I get the message:

        Cannot find file: mysql.pro.
        

        Thoughts?

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

        @SethTales Is there mysql.pro in ~/qt-everywhere-src-5.10.0/qtbase/plugins/sqldrivers ? I guess it is in mysql subdirectory?

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

        1 Reply Last reply
        1
        • S Offline
          S Offline
          SethTales
          wrote on last edited by
          #9

          No there is not. In fact, I can't find a MySQL.pro file anywhere on my system. Is this a file I need to create?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SethTales
            wrote on last edited by
            #10

            Do I need to explicitly call qmake from the qt-everywhere-src-5.10.0 folder?

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

              It should be in qtbase/src/plugins/sqldrivers/mysql/. If not then you should consider re-downloading the sources.

              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
              • S Offline
                S Offline
                SethTales
                wrote on last edited by
                #12

                It is not there. How do I ensure that it is there when I re-download the sources?

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13
                  1. Download the sources
                  2. Un-compress the archive
                  3. Take a look in the folder mentioned before

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

                    OK, but what if the mysql.pro file is not in the folder above? I ask because since I will be downloading the same archive as I used earlier, that has led me to the problem of the mysql.pro file not being there. I assume this will be the case again. If this is the case, how to I obtain sources that contain the proper files for making the plugin with mysql?

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

                      Where did you get the sources from ?

                      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
                      • S Offline
                        S Offline
                        SethTales
                        wrote on last edited by
                        #16

                        I downloaded the tar.xz archive from https://www1.qt.io/offline-installers/

                        1 Reply Last reply
                        0
                        • S SethTales

                          I believe I am making progress. Found a good resource. Here's a more open-ended question: how would one know they needed to compile Qt from source code in order to use MySQL? It's definitely not spelled out anywhere in the documentation that I could find, and it's taken me the better part of a week (off and on) to troubleshoot it. Is this just a weird edge-case that doesn't happen often, or is the standard way that all development packages should be installed to ensure dependencies are met?

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by
                          #17

                          @SethTales said in QMYSQL Driver not loaded but available:

                          Here's a more open-ended question: how would one know they needed to compile Qt from source code in order to use MySQL?

                          Just to be clear: You do not have to compile Qt from source code to use MySQL (or almost anything else). You have to because you are choosing the latest Qt release, 5.10.

                          Instead, you are using Ubuntu 16.04, you could accept the pre-compiled packages, available through standard apt-get, for the version of Qt that was current at the time 16.04 was released. I think that was Qt 5.5., BTW.

                          For example, I use Ubuntu 17.04 now, and the apt-get package gives me Qt 5.7.1. Similarly, I use whatever the version of MySQL was for 17.04. I have not fetched a line of source code or done any compiling at all. And thankful for that!

                          When 18.04 comes out, I will do same, upgrading to whatever versions of Qt & MySQL are available then through apt-get.

                          So it in part depends on whether you need the latest version of Qt or not.

                          S 1 Reply Last reply
                          1
                          • JonBJ JonB

                            @SethTales said in QMYSQL Driver not loaded but available:

                            Here's a more open-ended question: how would one know they needed to compile Qt from source code in order to use MySQL?

                            Just to be clear: You do not have to compile Qt from source code to use MySQL (or almost anything else). You have to because you are choosing the latest Qt release, 5.10.

                            Instead, you are using Ubuntu 16.04, you could accept the pre-compiled packages, available through standard apt-get, for the version of Qt that was current at the time 16.04 was released. I think that was Qt 5.5., BTW.

                            For example, I use Ubuntu 17.04 now, and the apt-get package gives me Qt 5.7.1. Similarly, I use whatever the version of MySQL was for 17.04. I have not fetched a line of source code or done any compiling at all. And thankful for that!

                            When 18.04 comes out, I will do same, upgrading to whatever versions of Qt & MySQL are available then through apt-get.

                            So it in part depends on whether you need the latest version of Qt or not.

                            S Offline
                            S Offline
                            SethTales
                            wrote on last edited by
                            #18

                            @JonB Thank you for the clarification! That makes a ton more sense. I was beginning to wonder why connecting to a database is seemingly giving so many people so much trouble!

                            I've actually figured out a different way to solve the problem by using C++ MySQL Connector libraries provided by Oracle, and have gotten it working in my application! I will also try using the Qt and MySQL versions provided by my Ubuntu release and see how that goes.

                            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