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. More MySql issues.

More MySql issues.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 317 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.
  • C Offline
    C Offline
    Chrisw01
    wrote on 10 Mar 2023, 19:36 last edited by
    #1

    Greetings everyone,

    After a break from coding I decided to hit it again. I did a fresh install of Qt6 on Windows 10 pro. I am using 6.4.2. I have both MinGW and MS2019 Kits installed for this project. I have downloaded MySQL Server 8.0 (8.0.32 to be exact) installed it and compiled it for both MSVC and MinGW following various Guides. It seams to have completed and installed the libraries without issues. When I try to run the program I get this error.

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL
    

    Looking at all the references both here and the internet trying various things to fix it nothing seems to help. I ran it through dependency walker with the following outcome.

    298dcaa2-e056-488e-9efc-1ba04e070090-image.png

    Not quite sure where to go from here. Last time I set it up was the 5.2 days with the C connecter that just worked.

    Thanks

    C 1 Reply Last reply 10 Mar 2023, 19:41
    0
    • C Chrisw01
      10 Mar 2023, 19:36

      Greetings everyone,

      After a break from coding I decided to hit it again. I did a fresh install of Qt6 on Windows 10 pro. I am using 6.4.2. I have both MinGW and MS2019 Kits installed for this project. I have downloaded MySQL Server 8.0 (8.0.32 to be exact) installed it and compiled it for both MSVC and MinGW following various Guides. It seams to have completed and installed the libraries without issues. When I try to run the program I get this error.

      QSqlDatabase: QMYSQL driver not loaded
      QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QODBC QPSQL
      

      Looking at all the references both here and the internet trying various things to fix it nothing seems to help. I ran it through dependency walker with the following outcome.

      298dcaa2-e056-488e-9efc-1ba04e070090-image.png

      Not quite sure where to go from here. Last time I set it up was the 5.2 days with the C connecter that just worked.

      Thanks

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 10 Mar 2023, 19:41 last edited by
      #2

      As you can clearly see libmysql.dll is missing in your PATH (Qt6SQLd and QT6COREd are already loaded when the plugin gets loaded so this can be ignored here).

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

      C 1 Reply Last reply 10 Mar 2023, 19:45
      0
      • C Christian Ehrlicher
        10 Mar 2023, 19:41

        As you can clearly see libmysql.dll is missing in your PATH (Qt6SQLd and QT6COREd are already loaded when the plugin gets loaded so this can be ignored here).

        C Offline
        C Offline
        Chrisw01
        wrote on 10 Mar 2023, 19:45 last edited by
        #3

        @Christian-Ehrlicher said in More MySql issues.:

        As you can clearly see libmysql.dll is missing in your PATH (Qt6SQLd and QT6COREd are already loaded when the plugin gets loaded so this can be ignored here).

        I forgot to mention that I have placed the libmysql.dll files in the applications build folder per the instructions. They have also been placed within the lib files of the compiler as well.

        C 1 Reply Last reply 10 Mar 2023, 19:48
        0
        • C Chrisw01
          10 Mar 2023, 19:45

          @Christian-Ehrlicher said in More MySql issues.:

          As you can clearly see libmysql.dll is missing in your PATH (Qt6SQLd and QT6COREd are already loaded when the plugin gets loaded so this can be ignored here).

          I forgot to mention that I have placed the libmysql.dll files in the applications build folder per the instructions. They have also been placed within the lib files of the compiler as well.

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 10 Mar 2023, 19:48 last edited by
          #4

          @Chrisw01 said in More MySql issues.:

          They have also been placed within the lib files of the compiler as well.

          Why? What should this help?

          I don't know where you put them, the important thing is that the libmysql.dll is found when the application is run - so adjust your PATH accordingly. And don't mix MSVC and MinGW libs & plugins.

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

          C 1 Reply Last reply 10 Mar 2023, 20:20
          2
          • C Christian Ehrlicher
            10 Mar 2023, 19:48

            @Chrisw01 said in More MySql issues.:

            They have also been placed within the lib files of the compiler as well.

            Why? What should this help?

            I don't know where you put them, the important thing is that the libmysql.dll is found when the application is run - so adjust your PATH accordingly. And don't mix MSVC and MinGW libs & plugins.

            C Offline
            C Offline
            Chrisw01
            wrote on 10 Mar 2023, 20:20 last edited by
            #5

            @Christian-Ehrlicher said in More MySql issues.:

            @Chrisw01 said in More MySql issues.:

            They have also been placed within the lib files of the compiler as well.

            Why? What should this help?

            I don't know where you put them, the important thing is that the libmysql.dll is found when the application is run - so adjust your PATH accordingly. And don't mix MSVC and MinGW libs & plugins.

            Honestly, I have been fighting this problem all week. Reading blog after blog after blog. I did not mix up the libraries. I followed MSVC instructions for MSVC and MinGW instructions for it. The problem appears to be where to place the libmysql.dll file so it can be seen within Qt Creator while I Develop. I know it needs to be in the application folder when you distribute. Previously placing the libmysql.dll file within the applications build folder satisfied this apparently not anymore. I managed to find a fix however. I added created a folder and placed the required files there. Then I added LIBS += -L"C:\MySql" -lmysql to my project file and the program now works. May or may not be the proper way to do it but it works. I have not had to do this in the past but again, I've taken a break from Qt for a while and things may have changed.

            Thanks for your help..

            1 Reply Last reply
            0
            • C Chrisw01 has marked this topic as solved on 10 Mar 2023, 20:22

            4/5

            10 Mar 2023, 19:48

            • Login

            • Login or register to search.
            4 out of 5
            • First post
              4/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved