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: QMYSQL driver not loaded available drivers: QMYSQL

QSqlDatabase: QMYSQL driver not loaded available drivers: QMYSQL

Scheduled Pinned Locked Moved Solved General and Desktop
mysqldrivernot loaded
27 Posts 5 Posters 27.2k 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.
  • F Offline
    F Offline
    fennec
    wrote on 14 Apr 2015, 23:42 last edited by SGaist
    #1

    I am trying to connect to a MySQL database.
    It is currently give me this error:

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

    I have used: #include <QtSql> at the top. I have added QT += sql in the pro file.
    I have MySQL installed. I have the libmysql.dll in the same folder as my .exe.
    I have qsqlmysql.dll and qsqlmysqld.dll in /plugins/sqldrivers and also in a folder called sqldrivers where the .exe exists.
    I have made the qsqlmysql.dll and qsqlmysqld.dll files myself.

    I have ran out of ideas why is can not load but is available.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Apr 2015, 23:43 last edited by
      #2

      Hi and welcome to devnet,

      Do you also have the MySQL client libraries installed on your computer ?

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

      F 1 Reply Last reply 15 Apr 2015, 10:13
      1
      • M Offline
        M Offline
        mcosta
        wrote on 15 Apr 2015, 06:10 last edited by
        #3

        Hi,

        please guys, before create a new thread use the SEARCH tool in this forum.
        I (and probably a lot of guys like @SGaist) answered at least to 4/5 threads with exactly the same question in this week

        Once your problem is solved don't forget to:

        • Mark the thread as SOLVED using the Topic Tool menu
        • Vote up the answer(s) that helped you to solve the issue

        You can embed images using (http://imgur.com/) or (http://postimage.org/)

        1 Reply Last reply
        0
        • S SGaist
          14 Apr 2015, 23:43

          Hi and welcome to devnet,

          Do you also have the MySQL client libraries installed on your computer ?

          F Offline
          F Offline
          fennec
          wrote on 15 Apr 2015, 10:13 last edited by
          #4

          @SGaist I have the Connector/C++ installed, I also have MySQL Server, MySQL Workbench and MySQL for Visual Studio installed.

          P 1 Reply Last reply 15 Apr 2015, 10:39
          0
          • F fennec
            15 Apr 2015, 10:13

            @SGaist I have the Connector/C++ installed, I also have MySQL Server, MySQL Workbench and MySQL for Visual Studio installed.

            P Offline
            P Offline
            p3c0
            Moderators
            wrote on 15 Apr 2015, 10:39 last edited by
            #5

            @fennec Use dependencywalker to find out which dll's are missing. Check for qsqlmysql dll.

            157

            F 1 Reply Last reply 15 Apr 2015, 12:08
            1
            • P p3c0
              15 Apr 2015, 10:39

              @fennec Use dependencywalker to find out which dll's are missing. Check for qsqlmysql dll.

              F Offline
              F Offline
              fennec
              wrote on 15 Apr 2015, 12:08 last edited by fennec
              #6

              @p3c0 I used the dependenctwalker as these are the missing .dll's but its not anything to do with mysql

              API-MS-WIN-APPMODEL-RUNTIME-L1-1-0.DLL
              API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
              API-MS-WIN-CORE-WINRT-L1-1-0.DLL
              API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
              API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
              API-MS-WIN-SHCORE-SCALING-L1-1-1.DLL
              DCOMP.DLL
              IESHIMS.DLL
              

              I used Profiling and when I click the button that calls the mysql to connect i get this:

              Loaded "QSQLMYSQLD.DLL" at address 0x000000006AD80000.  Successfully hooked module.
              Unloaded "QSQLMYSQLD.DLL" at address 0x000000006AD80000.
              LoadLibraryW("E:\Qt\5.4\msvc2013_64\plugins\sqldrivers\qsqlmysqld.dll") returned NULL. Error: %1 is not a valid Win32 application (193).
              QSqlDatabase: QMYSQL driver not loaded
              QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
              

              I have qsqlmysqld.dll in that folder.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mcosta
                wrote on 15 Apr 2015, 17:39 last edited by mcosta
                #7

                Hi,

                is the mysqlclient.dll in your PATH??

                Which compiler/kit are you using?

                May help?? https://forum.qt.io/topic/53247/solved-qtsql-and-xampp-mysql-qmysqldriver-not-loaded/6

                Once your problem is solved don't forget to:

                • Mark the thread as SOLVED using the Topic Tool menu
                • Vote up the answer(s) that helped you to solve the issue

                You can embed images using (http://imgur.com/) or (http://postimage.org/)

                F 1 Reply Last reply 15 Apr 2015, 18:13
                1
                • M mcosta
                  15 Apr 2015, 17:39

                  Hi,

                  is the mysqlclient.dll in your PATH??

                  Which compiler/kit are you using?

                  May help?? https://forum.qt.io/topic/53247/solved-qtsql-and-xampp-mysql-qmysqldriver-not-loaded/6

                  F Offline
                  F Offline
                  fennec
                  wrote on 15 Apr 2015, 18:13 last edited by
                  #8

                  @mcosta I have now added the lib of XMAPP and MYSQL server to path and Path still the same problem.
                  I am currently using: Desktop QT 5.4.1 MSVC2013 64bit
                  My other option is: Desktop QT 5.4.1 MSVC2010 OpenGL 32bit, but this give the error: LNK1104: cannot open file 'libmysql.lib'

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mcosta
                    wrote on 15 Apr 2015, 18:16 last edited by
                    #9

                    Just to be sure:

                    1. In which directory is the mysqlclient library?
                    2. can you post the %PATH% contents?

                    Once your problem is solved don't forget to:

                    • Mark the thread as SOLVED using the Topic Tool menu
                    • Vote up the answer(s) that helped you to solve the issue

                    You can embed images using (http://imgur.com/) or (http://postimage.org/)

                    F 1 Reply Last reply 15 Apr 2015, 19:35
                    0
                    • M mcosta
                      15 Apr 2015, 18:16

                      Just to be sure:

                      1. In which directory is the mysqlclient library?
                      2. can you post the %PATH% contents?
                      F Offline
                      F Offline
                      fennec
                      wrote on 15 Apr 2015, 19:35 last edited by
                      #10

                      @mcosta the mysqlclient lib is in: C:\Program Files\MySQL\MySQL Server 5.6\lib

                      This is User Variables:

                      C:\Program Files\MySQL\MySQL Server 5.6\lib
                      E:\Qt\5.4\mingw491_32\plugins\sqldrivers
                      C:\WINDOWS\
                      E:\Python27
                      %CommonProgramFiles%\Microsoft Shared\Windows Live
                      E:\xampp\mysql\lib
                      

                      This is System Variables:

                      C:\Program Files\MySQL\MySQL Server 5.6\lib
                      E:\xampp\mysql\lib
                      C:\ProgramData\Oracle\Java\javapath
                      E:\Program Files\Microsoft Solver Foundation\3.0.2.10889\Plugins
                      C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
                      %CommonProgramFiles%\Microsoft Shared\Windows Live
                      C:\Program Files (x86)\Intel\iCLS Client\
                      C:\Program Files\Intel\iCLS Client\
                      C:\Windows\system32
                      C:\Windows
                      C:\Windows\System32\Wbem
                      C:\Windows\System32\WindowsPowerShell\v1.0\
                      C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
                      C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
                      C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
                      C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
                      C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
                      C:\Program Files\Microsoft SQL Server\100\Tools\Binn\
                      C:\Program Files\Microsoft SQL Server\100\DTS\Binn\
                      C:\Program Files\TortoiseSVN\bin
                      C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
                      C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\
                      C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
                      E:\xampp\php
                      C:\ProgramData\ComposerSetup\bin
                      C:\Program Files (x86)\Skype\Phone\
                      C:\Program Files\MySQL\MySQL Server 5.6\lib
                      E:\Qt\5.4\mingw491_32\plugins\sqldrivers
                      
                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mcosta
                        wrote on 15 Apr 2015, 20:08 last edited by
                        #11

                        Hi,

                        do you have mysql both in C:\Program Files\MySQL\MySQL Server 5.6\lib and E:\xampp\mysql\lib ??

                        Which version of MySQL do you used to build the Qt driver?
                        Keep in mind that the MinGW version of Qt is built in 32bit so you cannot load 64bit libraries

                        Once your problem is solved don't forget to:

                        • Mark the thread as SOLVED using the Topic Tool menu
                        • Vote up the answer(s) that helped you to solve the issue

                        You can embed images using (http://imgur.com/) or (http://postimage.org/)

                        F 1 Reply Last reply 15 Apr 2015, 22:35
                        0
                        • M mcosta
                          15 Apr 2015, 20:08

                          Hi,

                          do you have mysql both in C:\Program Files\MySQL\MySQL Server 5.6\lib and E:\xampp\mysql\lib ??

                          Which version of MySQL do you used to build the Qt driver?
                          Keep in mind that the MinGW version of Qt is built in 32bit so you cannot load 64bit libraries

                          F Offline
                          F Offline
                          fennec
                          wrote on 15 Apr 2015, 22:35 last edited by
                          #12

                          @mcosta I have libmysql.lib in both folders

                          I used the mysql 5.6.24 server to make the files which is the latest version.

                          Since I cant use the 32bit driver for the 64bit. [ill look into making the 64bit later]

                          the 32bit version i cannnot build as it give the error: LNK1104: cannot open file 'libmysql.lib'

                          I used 'Add Library...' to add libmysql.lib and is put this in the .pro file

                          win32:CONFIG(release, debug|release): LIBS += -L$$PWD/C:/Program Files/MySQL/MySQL Server 5.6/lib/ -llibmysql
                          else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/C:/Program Files/MySQL/MySQL Server 5.6/lib/ -llibmysqld
                          else:unix: LIBS += -L$$PWD/C:/Program Files/MySQL/MySQL Server 5.6/lib/ -llibmysql
                          
                          INCLUDEPATH += $$PWD/C:/Program Files/MySQL/MySQL Server 5.6/include
                          DEPENDPATH += $$PWD/C:/Program Files/MySQL/MySQL Server 5.6/include
                          

                          but still give the same error.

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 15 Apr 2015, 22:41 last edited by
                            #13

                            It should be -lmysql

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

                            F 1 Reply Last reply 17 Apr 2015, 17:08
                            0
                            • M Offline
                              M Offline
                              mcosta
                              wrote on 15 Apr 2015, 23:11 last edited by
                              #14

                              IIRC (sorry now I'm on Mac) in Windows you need to quote paths if they contain spaces.

                              Once your problem is solved don't forget to:

                              • Mark the thread as SOLVED using the Topic Tool menu
                              • Vote up the answer(s) that helped you to solve the issue

                              You can embed images using (http://imgur.com/) or (http://postimage.org/)

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mcosta
                                wrote on 15 Apr 2015, 23:18 last edited by
                                #15

                                Have you built the Qt driver?? what is the MySQL version used for it??

                                IIRC the standard version of MySQL per Windows is built with Visual C++ (I think 64bit); so you cannot link it to a Mingw32 version of Qt

                                Once your problem is solved don't forget to:

                                • Mark the thread as SOLVED using the Topic Tool menu
                                • Vote up the answer(s) that helped you to solve the issue

                                You can embed images using (http://imgur.com/) or (http://postimage.org/)

                                1 Reply Last reply
                                0
                                • S SGaist
                                  15 Apr 2015, 22:41

                                  It should be -lmysql

                                  F Offline
                                  F Offline
                                  fennec
                                  wrote on 17 Apr 2015, 17:08 last edited by
                                  #16

                                  @SGaist -lmysql didnt help sorry.
                                  @mcosta I built the driver myself, using the mysql server 5.6 to build the program 32bit
                                  currently im making a vmware station of linux and win7 clean installs and install qt and mysql on that and try it out.
                                  though i have been busy the last couple of days this may take some time.

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on 17 Apr 2015, 20:12 last edited by
                                    #17

                                    One thing's not clear, are you trying to build the plugin against the embedded MySQL server ?

                                    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
                                    • M Offline
                                      M Offline
                                      mcosta
                                      wrote on 17 Apr 2015, 20:16 last edited by
                                      #18

                                      @fennec As I said in a previous post you should check that the MySQL version you're using to build the Qt Driver is in 32bit because you're using a 32bit Qt version.

                                      And really I don't understand why you have two different version of MySQL installed on your machine

                                      Once your problem is solved don't forget to:

                                      • Mark the thread as SOLVED using the Topic Tool menu
                                      • Vote up the answer(s) that helped you to solve the issue

                                      You can embed images using (http://imgur.com/) or (http://postimage.org/)

                                      1 Reply Last reply
                                      0
                                      • F Offline
                                        F Offline
                                        fennec
                                        wrote on 23 Apr 2015, 23:25 last edited by
                                        #19

                                        I have made a VM of windows 7 and it works. so something is wrong with my pc but works on a clean win7.

                                        1 Reply Last reply
                                        0
                                        • E Offline
                                          E Offline
                                          EXTREME
                                          wrote on 28 Dec 2016, 22:25 last edited by
                                          #20

                                          Hello everybody!
                                          Firstly I'm sorry for resurrecting the thread, but my question is the same of the OP and I don't want to create a new one topic for the same problem.

                                          Let me state what's happening with me:
                                          I have Qt 5.7 and also MySQL 5.5 installed on my PC, I'm using mysql database on my program and it works... I do everything with it, read and write on database. No problem here.

                                          When I deploy the app using the 'windeployqt' it generates all the dlls needed to the program run BUT the database don't connects and I get the error "Driver not loaded"... Crazy..

                                          The mysql server is running and accessible for external connections. I'm connected on it by MySQL Workbench, so.. it's not about the access, its the driver...

                                          I really don't understand how it works on my PC and the deploied program doesn't.

                                          Please help me!

                                          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