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
Forum Update on Monday, May 27th 2025

QSqlDatabase: QMYSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 7 Posters 4.3k 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.
  • N Offline
    N Offline
    nn26
    wrote on last edited by nn26
    #1

    link text
    After following above link and building sqldrivers (visual studio 2019, Qt 5.14.0), I am still getting this error,

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    ERROR: Adding database failed!
    

    any idea what am I missing?
    I have also added libmysql.dll to qt bin folder and also tried with setting system variable. but still come this error.

    Thanks.

    N 1 Reply Last reply
    0
    • N nn26

      link text
      After following above link and building sqldrivers (visual studio 2019, Qt 5.14.0), I am still getting this error,

      QSqlDatabase: QMYSQL driver not loaded
      QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
      ERROR: Adding database failed!
      

      any idea what am I missing?
      I have also added libmysql.dll to qt bin folder and also tried with setting system variable. but still come this error.

      Thanks.

      N Offline
      N Offline
      nn26
      wrote on last edited by
      #2

      solved by setting MySQL path in user variable for administrator instead of setting it in system variable.

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

        Or by simply copying the needed dlls (e.g. by searching them with Dependency Walker) to the application directory: https://doc.qt.io/qt-5/sql-driver.html#qmysql

        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
        2
        • M Offline
          M Offline
          Mounir
          wrote on last edited by
          #4

          hey pleas can you help me how to seeting Mysql path

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hehedaozuiteng
            wrote on last edited by
            #5

            https://forum.qt.io/topic/110176/build-qmysql-driver-under-windows-10-a-sample-solution-for-qsqldatabase-qmysql-driver-not-loaded

            I meet the similar situation, Trying my post?

            the new vision of qt also support the new dll, only thing you neet to do is reinstall the whole qt which vision 5.14.2.

            If it is not work, you should put the libmysql.dll on the same folder which is your .exe file generaled.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mounir
              wrote on last edited by
              #6

              THANX BRO I FOLLOWD ALL STEPS AND I BUILD QMYSQL DRIVER BUT IT NOT LOAD

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

                Hi,

                Please avoid using all caps word like that, it's considered shouting in written language and rude.

                As for your issue, did you make sure that the MySQL dlls are found at runtime ?

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

                M 1 Reply Last reply
                1
                • M Mounir

                  THANX BRO I FOLLOWD ALL STEPS AND I BUILD QMYSQL DRIVER BUT IT NOT LOAD

                  T Offline
                  T Offline
                  Thombou
                  wrote on last edited by
                  #8

                  @Mounir Did you have a look here?
                  https://forum.qt.io/topic/113840/mysql-not-defined-when-compiling-mysql-driver/37

                  I had a similar issue and the problem was that the libmysql.dll file needed 2 additional dll to work (LIBSSL-1_1X64.DLL and LIBCRYPTO-1_1-x64.DLL). You can check that by opening your libmysql.dll and in the dependancy walker.

                  1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Hi,

                    Please avoid using all caps word like that, it's considered shouting in written language and rude.

                    As for your issue, did you make sure that the MySQL dlls are found at runtime ?

                    M Offline
                    M Offline
                    Mounir
                    wrote on last edited by
                    #9

                    @SGaist said in QSqlDatabase: QMYSQL driver not loaded:

                    Hi,

                    Please avoid using all caps word like that, it's considered shouting in written language and rude.

                    As for your issue, did you make sure that the MySQL dlls are found at runtime ?

                    Sorry SGaist i was frustrated i didn't paid attention

                    1 Reply Last reply
                    1
                    • M Offline
                      M Offline
                      Malibob
                      wrote on last edited by
                      #10

                      Hey I'm try to solve this problem. When i run the code, "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
                      1

                      • Login

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