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. Unable to connect to MySQL, driver not loaded
Forum Updated to NodeBB v4.3 + New Features

Unable to connect to MySQL, driver not loaded

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 2.7k 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.
  • D Offline
    D Offline
    DanilZ
    wrote on last edited by DanilZ
    #3

    Thank you for reaching out!

    This is the problem. Everyone points to the documentation without any explanation and nowhere there is a comprehensive guide. I have not had the experience in drivers configuration and database management, only learning.

    Your link provides instruction to Compile only a specific sql driver, but the paths to the directories in the code sample do not overlap with my local paths in no way. There are simply no such directories.
    For instance:
    C:\Qt\6.0.0\mingw81_64\bin\qt-cmake -G Ninja C:\Qt\6.0.0\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.0.0\mingw81_64"

    My Qt directory does not have mingw81_64 as well as bin in any subfolders of QT.
    please refer to the screenshot below

    Screenshot 2022-06-23 at 20.20.07.jpg

    I have tried all the possible directory combinations but it is kinda hard when you don't know what you are doing.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Again - when you want to compile something you need sources (at least it's the case for me, don't know if someone else can compile code without sources though). So you want to compile the Qt mysql driver you need theses sources. They're provided by your Qt online installer.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DanilZ
        wrote on last edited by
        #5

        That would be a great starting point! But where and what should I be looking for? I have installed Qt via $ pip install PyQt6

        JonBJ 1 Reply Last reply
        0
        • D DanilZ

          That would be a great starting point! But where and what should I be looking for? I have installed Qt via $ pip install PyQt6

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #6

          @DanilZ
          And I believe that is the problem/not sufficient.

          If you have to build drivers you are going to have to do C++ compilation on source code. I imagine PyQt installation does not provide the sources. You need to get the sources from a Qt installation download.

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by Christian Ehrlicher
            #7

            Or use another database like postgresql and blame mysql licensing. :)

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            1
            • D Offline
              D Offline
              DanilZ
              wrote on last edited by
              #8

              Postgres looks like a good choice since among my available drivers I have QPSQL. But when changing the .addDatabase('QPSQL') I again get the same error:

              Screenshot 2022-06-23 at 21.14.49.jpg

              I hope this one would be easier to mitigate?

              JonBJ 1 Reply Last reply
              0
              • D DanilZ

                Postgres looks like a good choice since among my available drivers I have QPSQL. But when changing the .addDatabase('QPSQL') I again get the same error:

                Screenshot 2022-06-23 at 21.14.49.jpg

                I hope this one would be easier to mitigate?

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by
                #9

                @DanilZ
                While you await @Christian-Ehrlicher

                Enter

                export QT_DEBUG_PLUGINS=1
                

                as a command and then re-run your command. Look through the diagnostic output for a clue as to why QPSQL is available but did not get loaded.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DanilZ
                  wrote on last edited by
                  #10

                  Here is what I've got

                  Screenshot 2022-06-23 at 22.36.24.jpg

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

                    Hi,

                    Did you install the Postgres application ?

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

                      That was the problem. Just installed it and now my program is failing at another point. But at least I've got passed the problem of initialising a DB object. Now it seems to be connecting to a database, thanks to you guys!

                      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