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. build QMYSQL driver under windows 10, a sample solution for QSqlDatabase: QMYSQL driver not loaded
Forum Updated to NodeBB v4.3 + New Features

build QMYSQL driver under windows 10, a sample solution for QSqlDatabase: QMYSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
35 Posts 11 Posters 9.3k 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.
  • M Offline
    M Offline
    mvsri
    wrote on 30 Dec 2019, 07:53 last edited by
    #2

    @hehedaozuiteng I think the problem is of missing libmysql.dll file.
    copy libmysql.dll to your QT's bin folder or else add the libmysql.dll to your system path using environment editor.

    H 1 Reply Last reply 30 Dec 2019, 21:28
    2
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 30 Dec 2019, 08:51 last edited by
      #3

      @hehedaozuiteng said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

      still in qt5.12.6, so should I reinstll it?

      Qt5.12.6 does no longer ship a pre-compiled Qt plugin for mysql anymore due to legal reasons. You have to build it by your own (or use e.g. postgresql): https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

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

      J H 2 Replies Last reply 30 Dec 2019, 08:56
      3
      • C Christian Ehrlicher
        30 Dec 2019, 08:51

        @hehedaozuiteng said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

        still in qt5.12.6, so should I reinstll it?

        Qt5.12.6 does no longer ship a pre-compiled Qt plugin for mysql anymore due to legal reasons. You have to build it by your own (or use e.g. postgresql): https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

        J Offline
        J Offline
        JonB
        wrote on 30 Dec 2019, 08:56 last edited by JonB
        #4

        @Christian-Ehrlicher
        What....??? I have used MySQL from Qt5 for Ubuntu & Windows for years, and never compiled anything. (We use Python, so none of us even install C++ compiler chains, and certainly not under Windoze.) Are you saying that of the latest Qt we now have to do compilations to obtain MySQL operability? :(

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 30 Dec 2019, 08:59 last edited by
          #5

          @JonB said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

          Are you saying that of the latest Qt we now have to do compilations to obtain MySQL operability? :(

          Yes, but blame MySQL, not Qt.

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

          J 1 Reply Last reply 30 Dec 2019, 09:07
          1
          • C Christian Ehrlicher
            30 Dec 2019, 08:59

            @JonB said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

            Are you saying that of the latest Qt we now have to do compilations to obtain MySQL operability? :(

            Yes, but blame MySQL, not Qt.

            J Offline
            J Offline
            JonB
            wrote on 30 Dec 2019, 09:07 last edited by JonB
            #6

            @Christian-Ehrlicher
            I shall blame whomever I choose to blame! ;)

            I just had a look at my Ubuntu 19.04. I fetched everything Qt, including the MySQL bits, via apt-get only, no sources/compilation. I see that OS release comes with Qt 5.12.2. You are saying that once I move to the next release of Ubuntu I will have to follow instructions to get sources and compile for MySQL interoperability? And for stinky Windows, I will have to muck about fetching & installing a C++ compiler? You sure about this? :( This applies to both Linux & Windows? Are you able to supply a link mentioning this for Qt 5.12.6 onward. please?

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 30 Dec 2019, 09:12 last edited by
              #7

              I'm pretty sure ubuntu will ship the mysql plugin also for Qt > 5.12.5 but the pre-compiled Qt you're getting with the Qt installer will no longer ship this plugin due to legal reasons.

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

              J 1 Reply Last reply 30 Dec 2019, 09:17
              2
              • C Christian Ehrlicher
                30 Dec 2019, 09:12

                I'm pretty sure ubuntu will ship the mysql plugin also for Qt > 5.12.5 but the pre-compiled Qt you're getting with the Qt installer will no longer ship this plugin due to legal reasons.

                J Offline
                J Offline
                JonB
                wrote on 30 Dec 2019, 09:17 last edited by
                #8

                @Christian-Ehrlicher
                Ahhhh! Fortunately I have never used the Qt installer, so hopefully I can breathe a sigh of relief over this :) I sit in Ubuntu, I can't even recall what I did to install Qt under Windoze :)

                1 Reply Last reply
                0
                • C Christian Ehrlicher
                  30 Dec 2019, 08:51

                  @hehedaozuiteng said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

                  still in qt5.12.6, so should I reinstll it?

                  Qt5.12.6 does no longer ship a pre-compiled Qt plugin for mysql anymore due to legal reasons. You have to build it by your own (or use e.g. postgresql): https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-windows

                  H Offline
                  H Offline
                  hehedaozuiteng
                  wrote on 30 Dec 2019, 21:02 last edited by hehedaozuiteng
                  #9

                  @Christian-Ehrlicher
                  hi, I try to follow the step of the link your showed. But there is no "Libs & Include Files" Module in mysql "Custom Install", and no file end with the /lib/opt in any my sql file.

                  I tried the following code on cmd, but nothing work.
                  cd C:\Qt\5.12.6\mingw73_32\bin\ (where qmake is )
                  qmake -- MYSQL_INCDIR=E:/mysql-8.0.18-winx64/include "MYSQL_LIBDIR=C:/Program Files/MySQL/MySQL Server 8.0/lib"

                  there is nothing happened.

                  1 Reply Last reply
                  0
                  • M mvsri
                    30 Dec 2019, 07:53

                    @hehedaozuiteng I think the problem is of missing libmysql.dll file.
                    copy libmysql.dll to your QT's bin folder or else add the libmysql.dll to your system path using environment editor.

                    H Offline
                    H Offline
                    hehedaozuiteng
                    wrote on 30 Dec 2019, 21:28 last edited by
                    #10

                    @mvsri

                    I put the libmysql.dll in QT bin before the posted, but not work. thank you for you help.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on 30 Dec 2019, 21:33 last edited by
                      #11

                      @hehedaozuiteng said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

                      I tried the following code on cmd, but nothing work.

                      I'm giving up - you simply don't care about the instructions and don't show us what we need to show and what we suggest you to do... why do you think anything will work inside C:\Qt\5.12.6\mingw73_32\bin\ when you want to compile the sql driver? Did you make sure the incdir and libdir are containing the files mentioned in my (second) instruction link?

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

                      H 2 Replies Last reply 30 Dec 2019, 22:09
                      0
                      • C Christian Ehrlicher
                        30 Dec 2019, 21:33

                        @hehedaozuiteng said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

                        I tried the following code on cmd, but nothing work.

                        I'm giving up - you simply don't care about the instructions and don't show us what we need to show and what we suggest you to do... why do you think anything will work inside C:\Qt\5.12.6\mingw73_32\bin\ when you want to compile the sql driver? Did you make sure the incdir and libdir are containing the files mentioned in my (second) instruction link?

                        H Offline
                        H Offline
                        hehedaozuiteng
                        wrote on 30 Dec 2019, 22:09 last edited by hehedaozuiteng
                        #12

                        @Christian-Ehrlicher
                        Do not be mad man. I just not realize how to build sql-driver.
                        the cmd does not running the qmake, I do not install qmake before I used it so I though I have to move to the where qmake.exe is.
                        Now I am install the qmake, perhep this time work and reinstall the mysql. Mysql is combine into differents programs, I cannot find the include and "/lib/opt" folder in it.

                        1 Reply Last reply
                        0
                        • C Christian Ehrlicher
                          30 Dec 2019, 21:33

                          @hehedaozuiteng said in QMYSQL driver not loaded, how to get the qsqlmysql.dll for qt5.12.6 ?:

                          I tried the following code on cmd, but nothing work.

                          I'm giving up - you simply don't care about the instructions and don't show us what we need to show and what we suggest you to do... why do you think anything will work inside C:\Qt\5.12.6\mingw73_32\bin\ when you want to compile the sql driver? Did you make sure the incdir and libdir are containing the files mentioned in my (second) instruction link?

                          H Offline
                          H Offline
                          hehedaozuiteng
                          wrote on 30 Dec 2019, 22:52 last edited by hehedaozuiteng
                          #13

                          @Christian-Ehrlicher

                          Can you tell me what is the file that include in the "incdir" and "libdir" folder ?
                          I reinstalled the mysql, but cannot find the folder such as your described in instruction. Thank you very much.

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            thecodemonkey
                            wrote on 1 Jan 2020, 21:41 last edited by
                            #14

                            in the hope i can help someone: I provide various versions of qsqlmysql.dll here on Github

                            H C C 3 Replies Last reply 2 Jan 2020, 07:12
                            0
                            • T thecodemonkey
                              1 Jan 2020, 21:41

                              in the hope i can help someone: I provide various versions of qsqlmysql.dll here on Github

                              H Offline
                              H Offline
                              hehedaozuiteng
                              wrote on 2 Jan 2020, 07:12 last edited by hehedaozuiteng 1 Feb 2020, 07:51
                              #15

                              @thecodemonkey
                              Thank for you help anyway.
                              I solved it two days ago. BTW, I do not think 32 bit vision is useful, ( if I am wrong please point out.) Mysql's serves is only offer 64 bit, so the libmysql.dll is also 64 bits. That is why I cannot build the drive at first 2 days lol.

                              If someone like me do not know this, he will kill his two days beautiful life XD.

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                Malibob
                                wrote on 23 May 2020, 20:18 last edited by
                                #16

                                When I run this "qmake -- MYSQL_INCDIR="%Mysql%/MySQL Server 8.0/include" MYSQL_LIBDIR="%Mysql%/MySQL Server 8.0/lib" " it's show me the message " QMake has two modes, one mode for generating project files based on some heuristics, and the other for generating makefiles. Normally you shouldn't need to specify a mode, as makefile generation is the default mode for qmake, but you may use this to test qmake on an existing project " How can i solve this?

                                1 Reply Last reply
                                0
                                • T thecodemonkey
                                  1 Jan 2020, 21:41

                                  in the hope i can help someone: I provide various versions of qsqlmysql.dll here on Github

                                  C Offline
                                  C Offline
                                  Camilo Quijano
                                  wrote on 21 Apr 2021, 21:35 last edited by
                                  #17

                                  @thecodemonkey Thank you so much. Your files solved my problem.

                                  1 Reply Last reply
                                  0
                                  • terma.abaT Offline
                                    terma.abaT Offline
                                    terma.aba
                                    wrote on 13 May 2021, 08:03 last edited by
                                    #18
                                    This post is deleted!
                                    1 Reply Last reply
                                    0
                                    • T thecodemonkey
                                      1 Jan 2020, 21:41

                                      in the hope i can help someone: I provide various versions of qsqlmysql.dll here on Github

                                      C Offline
                                      C Offline
                                      cpplegend
                                      wrote on 29 Jun 2023, 12:34 last edited by
                                      #19

                                      @thecodemonkey man I am using qt6.5.1, when I try to compile the driver it says that it doesn't recognize some lines of code when trying to build it... I am following this (the official qt documentation).. I think it doesn't find the mingw compiler.. I installed a new one but it does not work, it isn't recognized by the system also I'm using windows 11.. should I show you what are the errors? (I warn you, they are a lot)

                                      jsulmJ 1 Reply Last reply 29 Jun 2023, 12:36
                                      0
                                      • C cpplegend
                                        29 Jun 2023, 12:34

                                        @thecodemonkey man I am using qt6.5.1, when I try to compile the driver it says that it doesn't recognize some lines of code when trying to build it... I am following this (the official qt documentation).. I think it doesn't find the mingw compiler.. I installed a new one but it does not work, it isn't recognized by the system also I'm using windows 11.. should I show you what are the errors? (I warn you, they are a lot)

                                        jsulmJ Offline
                                        jsulmJ Offline
                                        jsulm
                                        Lifetime Qt Champion
                                        wrote on 29 Jun 2023, 12:36 last edited by
                                        #20

                                        @cpplegend said in build QMYSQL driver under windows 10, a sample solution for QSqlDatabase: QMYSQL driver not loaded:

                                        it isn't recognized by the system

                                        If you want to build in a terminal on Windows then you should always use the terminal provided by Qt. If you installed Qt for MinGW you should have an entry in Windows Start menu to open the terminal preconfigured to use MinGW and Qt.

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

                                        C 1 Reply Last reply 29 Jun 2023, 12:46
                                        0
                                        • jsulmJ jsulm
                                          29 Jun 2023, 12:36

                                          @cpplegend said in build QMYSQL driver under windows 10, a sample solution for QSqlDatabase: QMYSQL driver not loaded:

                                          it isn't recognized by the system

                                          If you want to build in a terminal on Windows then you should always use the terminal provided by Qt. If you installed Qt for MinGW you should have an entry in Windows Start menu to open the terminal preconfigured to use MinGW and Qt.

                                          C Offline
                                          C Offline
                                          cpplegend
                                          wrote on 29 Jun 2023, 12:46 last edited by
                                          #21

                                          @jsulm ok now I know I am stupid

                                          jsulmJ 1 Reply Last reply 29 Jun 2023, 12:48
                                          0

                                          • Login

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