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
QtWS25 Last Chance

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.
  • M mcosta

    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 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      0
      • M Offline
        M Offline
        mcosta
        wrote on 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 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
          • SGaistS SGaist

            It should be -lmysql

            F Offline
            F Offline
            fennec
            wrote on 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
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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 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 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 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
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #21

                      @EXTREME Hi and welcome to devnet,

                      Did you also deploy the MySQL client .dlls with your application ?

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

                      E 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        @EXTREME Hi and welcome to devnet,

                        Did you also deploy the MySQL client .dlls with your application ?

                        E Offline
                        E Offline
                        EXTREME
                        wrote on last edited by
                        #22

                        Hi @SGaist, thanks.

                        Yes, there are the qsqlmysql.dll on sqldrivers folder, and I copied manually the libmysql.dll to the exe folder and the sqldriver folder.

                        Thing is, the app run on my computer, where I'm compiling and deploying from the deploied folder but I copied the whole program folder to my girlfriend's pc and I get the 'Driver not loaded' error.

                        I also installed the MySQL Connector C on it, but.. nothing.

                        Just to make sure I have those dlls on sqldriver folder:
                        libmysql
                        qsqlite
                        qsqlmysql
                        qsqlmysql4
                        qsqlodbc
                        qsqlpsql

                        The program just doesn't connect to the database because of drivers.
                        I can't figure out what to do now :(

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

                          Run Dependency Walker on the plugin to see if it finds anything.

                          You can also start the application in command line window and use QT_DEBUG_PLUGINS environment variable. That should give you more hints about what is going on.

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

                          E 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Run Dependency Walker on the plugin to see if it finds anything.

                            You can also start the application in command line window and use QT_DEBUG_PLUGINS environment variable. That should give you more hints about what is going on.

                            E Offline
                            E Offline
                            EXTREME
                            wrote on last edited by
                            #24

                            @SGaist said in [Solved] QSqlDatabase: QMYSQL driver not loaded available drivers: QMYSQL:

                            Run Dependency Walker on the plugin to see if it finds anything.

                            You can also start the application in command line window and use QT_DEBUG_PLUGINS environment variable. That should give you more hints about what is going on.

                            Running Dependency Walker on the exe ?
                            If yes, here is it:
                            alt text

                            Maybe are the microsoft runtimes missing? Or anything else? I saw that the dll IESHIMS.dll was missing, I found it on Internet Explorer's folder and copied to the exe folder, but still not working.. the app loads but with the 'Driver not found' error..

                            Thats turning my hairs into grey lol

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

                              No, not the executable, the Qt MySQL plugin.

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

                              E 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                No, not the executable, the Qt MySQL plugin.

                                E Offline
                                E Offline
                                EXTREME
                                wrote on last edited by
                                #26

                                @SGaist said in [Solved] QSqlDatabase: QMYSQL driver not loaded available drivers: QMYSQL:

                                No, not the executable, the Qt MySQL plugin.

                                The qsqlmysql.dll ? If yes..
                                alt text
                                PS: I already have these dlls on the exe folder. Tried to copy to the sqldrivers folder, but got the same error "Driver not loaded".

                                1 Reply Last reply
                                0
                                • E Offline
                                  E Offline
                                  EXTREME
                                  wrote on last edited by
                                  #27

                                  God... finally got it working!!!

                                  Tried many libmysql.dlls and got one that works.

                                  Thanks @SGaist for your time :)

                                  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