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. Cant connect to mysql database: QMYSQL driver not loaded
Forum Updated to NodeBB v4.3 + New Features

Cant connect to mysql database: QMYSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
46 Posts 12 Posters 52.4k Views 4 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.
  • C Offline
    C Offline
    cdwijs
    wrote on last edited by
    #3

    Thanks Guapo,

    I have watched the video, but I did not succeed yet.
    I have run the maintenance tool, and added QT5.11.1-source.

    In the video, the file c:\qtSDK\4.8.1\src\plugins\sqldrivers\mysql\mysql.pro is used.
    On my system it has moved to here: C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro
    When I open the .pro file, I get the following messages:
    Cannot read C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: No such file or directory
    Project ERROR: Project has no top-level .qmake.conf file.
    Error while parsing file C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\mysql\mysql.pro. Giving up.
    Cannot read C:/qtsqldrivers-config.pri: No such file or directory
    Cannot read /mkspecs/modules-inst/qt_plugin_qsqlmysql.pri: No such file or directory
    C:/Qt/5.11.1/mingw53_32/mkspecs/features/qt_plugin.prf(81): Variable QT_PLUGINS is not defined.
    Project ERROR: Library 'mysql' is not defined.

    I don't have the file qtsqldrivers-config.pri anywhere below c:\qt.

    What can I do/check next?

    Cheers,
    Cedric

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cdwijs
      wrote on last edited by
      #4

      Hi All,

      I am trying to follow the instructions here, but I'm not successful yet. Configure reports MySql .................................. no

      I have taken the following steps:
      1)Add C:\Qt\Tools\mingw530_32\bin and C:\Qt\5.11.1\mingw53_32\bin to the path
      2)Open cmd.exe, and enter the following commands:

      cd c:\qt\5.11.1\Src\qtbase\src\plugins\sqldrivers
      c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program Files\MySQL\Connector C++ 1.1\lib\opt"
      
      Running configuration tests...
      Checking for DB2 (IBM)... no
      Checking for InterBase... no
      Checking for MySQL... no
      Checking for OCI (Oracle)... no
      Checking for ODBC... yes
      Checking for PostgreSQL... no
      Checking for SQLite (version 2)... no
      Checking for TDS (Sybase)... no
      Done running configuration tests.
      
      Configure summary:
      
      Qt Sql:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... yes
        PostgreSQL ............................. no
        SQLite2 ................................ no
        SQLite ................................. yes
          Using system provided SQLite ......... no
        TDS (Sybase) ........................... no
      
      Qt is now configured for building. Just run 'mingw32-make'.
      Once everything is built, Qt is installed.
      You should NOT run 'mingw32-make install'.
      Note that this build cannot be deployed to other machines or devices.
      Prior to reconfiguration, make sure you remove any leftovers from the previous build.
      c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>
      

      What did I miss?
      Cheers,
      Cedric

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cdwijs
        wrote on last edited by
        #5

        hi All,

        I also have installed the "MySQL Connector C 6.1", but configure still does not see mySQL:

        c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program
         Files\MySQL\MySQL Connector C 6.1\lib"
        
        Running configuration tests...
        Done running configuration tests.
        
        Configure summary:
        
        Qt Sql:
          DB2 (IBM) .............................. no
          InterBase .............................. no
          MySql .................................. no
          OCI (Oracle) ........................... no
          ODBC ................................... yes
          PostgreSQL ............................. no
          SQLite2 ................................ no
          SQLite ................................. yes
            Using system provided SQLite ......... no
          TDS (Sybase) ........................... no
        
        Qt is now configured for building. Just run 'mingw32-make'.
        Once everything is built, Qt is installed.
        You should NOT run 'mingw32-make install'.
        Note that this build cannot be deployed to other machines or devices.
        
        Prior to reconfiguration, make sure you remove any leftovers from
        the previous build.
        
        
        c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program
         Files\MySQL\MySQL Connector C 6.1\lib"
        Info: creating stash file C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\.qmake.
        stash
        
        Running configuration tests...
        Checking for DB2 (IBM)... no
        Checking for InterBase... no
        Checking for MySQL... no
        Checking for OCI (Oracle)... no
        Checking for ODBC... yes
        Checking for PostgreSQL... no
        Checking for SQLite (version 2)... no
        Checking for TDS (Sybase)... no
        Done running configuration tests.
        
        Configure summary:
        
        Qt Sql:
          DB2 (IBM) .............................. no
          InterBase .............................. no
          MySql .................................. no
          OCI (Oracle) ........................... no
          ODBC ................................... yes
          PostgreSQL ............................. no
          SQLite2 ................................ no
          SQLite ................................. yes
            Using system provided SQLite ......... no
          TDS (Sybase) ........................... no
        
        Qt is now configured for building. Just run 'mingw32-make'.
        Once everything is built, Qt is installed.
        You should NOT run 'mingw32-make install'.
        Note that this build cannot be deployed to other machines or devices.
        
        Prior to reconfiguration, make sure you remove any leftovers from
        the previous build.
        
        
        c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>
        

        Cheers,
        Cedric

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

          Hi,

          Did you check that your MySQL Connector is built for 32bit ?

          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
          1
          • C Offline
            C Offline
            cdwijs
            wrote on last edited by
            #7

            Hi Sgaist,

            My further experiments:
            I have downloaded the 32 bit C connector:https://downloads.mysql.com/archives/get/file/mysql-connector-c-6.1.11-win32.msi and installed it. Now I have this directory:
            C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib
            Due to the location it installed into, I'm confident that it's indeed 32 bits. So here we go again :-) I deleted all the generated files from C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers

            C:\Users\cedric>cd c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers
            c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib"
            
            Running configuration tests...
            Checking for DB2 (IBM)... no
            Checking for InterBase... no
            Checking for MySQL... no
            Checking for OCI (Oracle)... no
            Checking for ODBC... yes
            Checking for PostgreSQL... no
            Checking for SQLite (version 2)... no
            Checking for TDS (Sybase)... no
            Done running configuration tests.
            

            My config.log:

            Command line: "MYSQL_INCDIR=c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib"
            looking for library db2
            Trying source 0 (type inline) of library db2 ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\db2 && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -ldb2cli" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/db2
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\db2 && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\db2\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:2:20: fatal error: sqlcli.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            Trying source 1 (type inline) of library db2 ...
              => source failed condition '!config.win32'.
            test config.sqldrivers.libraries.db2 FAILED
            looking for library ibase
            Trying source 0 (type inline) of library ibase ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\ibase && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -lgds32_ms" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/ibase
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\ibase && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\ibase\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:2:19: fatal error: ibase.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            Trying source 1 (type inline) of library ibase ...
              => source failed condition '!config.win32'.
            test config.sqldrivers.libraries.ibase FAILED
            looking for library mysql
            Trying source 0 (type mysqlConfig) of library mysql ...
            mysql_config not found.
              => source produced no result.
            Trying source 1 (type mysqlConfig) of library mysql ...
            mysql_config not found.
              => source produced no result.
            Trying source 2 (type mysqlConfig) of library mysql ...
            mysql_config not found.
              => source produced no result.
            Trying source 3 (type mysqlConfig) of library mysql ...
            mysql_config not found.
              => source produced no result.
            Trying source 4 (type inline) of library mysql ...
              => source failed condition '!config.win32'.
            Trying source 5 (type inline) of library mysql ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -llibmysql" "INCLUDEPATH *= \"c:\\Program Files ^(x86^)\\MySQL\\MySQL Connector C 6.1\\lib\"" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -I"c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib" -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:5:19: fatal error: mysql.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            Trying source 6 (type inline) of library mysql ...
              => source failed condition '!config.win32'.
            test config.sqldrivers.libraries.mysql FAILED
            looking for library oci
            Trying source 0 (type inline) of library oci ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\oci && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -loci" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/oci
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\oci && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\oci\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:2:17: fatal error: oci.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            Trying source 1 (type inline) of library oci ...
              => source failed condition '!config.win32'.
            test config.sqldrivers.libraries.oci FAILED
            looking for library odbc
            Trying source 0 (type inline) of library odbc ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -lodbc32" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > g++ -Wl,-s -Wl,-subsystem,console -mthreads -o odbc.exe main.o  -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.6.11-win32\lib -LC:\Utils\postgresql\pgsql\lib -lodbc32 
             => source accepted.
            test config.sqldrivers.libraries.odbc succeeded
            looking for library psql
            Trying source 0 (type pkgConfig) of library psql ...
            pkg-config use disabled globally.
              => source produced no result.
            Trying source 1 (type psqlConfig) of library psql ...
            pg_config not found.
              => source produced no result.
            Trying source 2 (type psqlEnv) of library psql ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\psql && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -llibpq -lws2_32 -ladvapi32" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/psql
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\psql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\psql\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:2:22: fatal error: libpq-fe.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            Trying source 3 (type psqlEnv) of library psql ...
              => source failed condition '!config.win32'.
            test config.sqldrivers.libraries.psql FAILED
            looking for library sqlite2
            Trying source 0 (type inline) of library sqlite2 ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\sqlite2 && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -lsqlite" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/sqlite2
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\sqlite2 && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\sqlite2\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:2:20: fatal error: sqlite.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            test config.sqldrivers.libraries.sqlite2 FAILED
            looking for library tds
            Trying source 0 (type sybaseEnv) of library tds ...
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && C:\Qt\5.11.1\mingw53_32\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared warn_off console single_arch" "QMAKE_LIBDIR += C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.6.11-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "LIBS += -lNTWDBLIB" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
            + cd /d C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
            > del main.o
            > Could Not Find C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.o
            > g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.6.11-win32\include -IC:\Utils\postgresql\pgsql\include -IC:\Qt\5.11.1\mingw53_32\mkspecs\win32-g++  -o main.o main.cpp
            > main.cpp:2:22: fatal error: sybfront.h: No such file or directory
            > compilation terminated.
            > Makefile:415: recipe for target 'main.o' failed
            > mingw32-make: *** [main.o] Error 1
             => source failed verification.
            Trying source 1 (type sybaseEnv) of library tds ...
              => source failed condition '!config.win32'.
            test config.sqldrivers.libraries.tds FAILED
            

            my config.cache:

            cache.platform = win32-g++
            cache.xplatform = win32-g++
            cache.db2._KEYS_ = result msgs
            cache.db2.result = false
            cache.db2.msgs = "Trying source 0 (type inline) of library db2 ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\db2 && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -ldb2cli\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/db2" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\db2 && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\db2\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:20: fatal error: sqlcli.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification." "Trying source 1 (type inline) of library db2 ..." "  => source failed condition \'!config.win32\'."
            cache.ibase._KEYS_ = result msgs
            cache.ibase.result = false
            cache.ibase.msgs = "Trying source 0 (type inline) of library ibase ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\ibase && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -lgds32_ms\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/ibase" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\ibase && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\ibase\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:19: fatal error: ibase.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification." "Trying source 1 (type inline) of library ibase ..." "  => source failed condition \'!config.win32\'."
            cache.mysql._KEYS_ = result msgs
            cache.mysql.result = false
            cache.mysql.msgs = "Trying source 0 (type mysqlConfig) of library mysql ..." "mysql_config not found." "  => source produced no result." "Trying source 1 (type mysqlConfig) of library mysql ..." "mysql_config not found." "  => source produced no result." "Trying source 2 (type mysqlConfig) of library mysql ..." "mysql_config not found." "  => source produced no result." "Trying source 3 (type mysqlConfig) of library mysql ..." "mysql_config not found." "  => source produced no result." "Trying source 4 (type inline) of library mysql ..." "  => source failed condition \'!config.win32\'." "Trying source 5 (type inline) of library mysql ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -llibmysql\" \"INCLUDEPATH *= \\\"c:\\\\Program Files ^(x86^)\\\\MySQL\\\\MySQL Connector C 6.1\\\\lib\\\"\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -I\"c:\\Program Files (x86)\\MySQL\\MySQL Connector C 6.1\\lib\" -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:5:19: fatal error: mysql.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification." "Trying source 6 (type inline) of library mysql ..." "  => source failed condition \'!config.win32\'."
            cache.oci._KEYS_ = result msgs
            cache.oci.result = false
            cache.oci.msgs = "Trying source 0 (type inline) of library oci ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\oci && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -loci\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/oci" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\oci && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\oci\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:17: fatal error: oci.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification." "Trying source 1 (type inline) of library oci ..." "  => source failed condition \'!config.win32\'."
            cache.odbc._KEYS_ = result msgs source sources.0.libs sources.0.includedir sources.0.cflags sources.0.version sources.0.export
            cache.odbc.result = true
            cache.odbc.msgs = "Trying source 0 (type inline) of library odbc ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\odbc && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -lodbc32\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\odbc && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> g++ -Wl,-s -Wl,-subsystem,console -mthreads -o odbc.exe main.o  -LC:\\openssl\\lib -LC:\\Utils\\my_sql\\mysql-5.6.11-win32\\lib -LC:\\Utils\\postgresql\\pgsql\\lib -lodbc32 " " => source accepted."
            cache.odbc.source = 0
            cache.odbc.sources.0.libs = -lodbc32
            cache.odbc.sources.0.includedir = 
            cache.odbc.sources.0.cflags = 
            cache.odbc.sources.0.version = 
            cache.odbc.sources.0.export = 
            cache.psql._KEYS_ = result msgs
            cache.psql.result = false
            cache.psql.msgs = "Trying source 0 (type pkgConfig) of library psql ..." "pkg-config use disabled globally." "  => source produced no result." "Trying source 1 (type psqlConfig) of library psql ..." "pg_config not found." "  => source produced no result." "Trying source 2 (type psqlEnv) of library psql ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\psql && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -llibpq -lws2_32 -ladvapi32\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/psql" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\psql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\psql\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:22: fatal error: libpq-fe.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification." "Trying source 3 (type psqlEnv) of library psql ..." "  => source failed condition \'!config.win32\'."
            cache.sqlite2._KEYS_ = result msgs
            cache.sqlite2.result = false
            cache.sqlite2.msgs = "Trying source 0 (type inline) of library sqlite2 ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\sqlite2 && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -lsqlite\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/sqlite2" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\sqlite2 && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\sqlite2\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:20: fatal error: sqlite.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification."
            cache.tds._KEYS_ = result msgs
            cache.tds.result = false
            cache.tds.msgs = "Trying source 0 (type sybaseEnv) of library tds ..." "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\tds && C:\\Qt\\5.11.1\\mingw53_32\\bin\\qmake.exe \"CONFIG -= qt debug_and_release app_bundle lib_bundle\" \"CONFIG += shared warn_off console single_arch\" \"QMAKE_LIBDIR += C:\\\\openssl\\\\lib C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.6.11-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"LIBS += -lNTWDBLIB\" C:/Qt/5.11.1/Src/qtbase/src/plugins/sqldrivers/config.tests/tds" "+ cd /d C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find C:\\Qt\\5.11.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\tds\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++11 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.6.11-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -IC:\\Qt\\5.11.1\\mingw53_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:22: fatal error: sybfront.h: No such file or directory" "> compilation terminated." "> Makefile:415: recipe for target \'main.o\' failed" "> mingw32-make: *** [main.o] Error 1" " => source failed verification." "Trying source 1 (type sybaseEnv) of library tds ..." "  => source failed condition \'!config.win32\'."
            

            qtsqldrivers-config.pri

            QT.sqldrivers.enabled_features = 
            QT.sqldrivers.disabled_features = 
            QT.sqldrivers.QT_CONFIG = 
            QT.sqldrivers.exports = 
            QT.sqldrivers_private.enabled_features = sql-odbc sql-sqlite
            QT.sqldrivers_private.disabled_features = sql-db2 sql-ibase sql-mysql sql-oci sql-psql sql-sqlite2 sql-tds system-sqlite
            QT.sqldrivers_private.libraries = odbc
            QMAKE_LIBS_ODBC = -lodbc32
            

            Cheers,
            Cedric

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

              Where exactly do you have mysql.h located 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

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cdwijs
                wrote on last edited by
                #9

                Hi, i have mysql.h at the following locations:

                C:\Program Files\MySQL\MySQL Server 8.0\include
                C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include
                C:\Program Files\MySQL\MySQL Connector C 6.1\include

                Cheers,
                Cedric

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

                  Then why are you using MYSQL_INCDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib" ?
                  It should be includeand not lib.

                  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
                  1
                  • C Offline
                    C Offline
                    cdwijs
                    wrote on last edited by
                    #11

                    Thank you.
                    I used /lib because it's in on the instructions on the Qt website: http://doc.qt.io/qt-5/sql-driver.html Can I file a bug report for the instructions on the site?

                    How to Build the QMYSQL Plugin on Windows
                    
                    You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):
                    cd %QTDIR%\qtbase\src\plugins\sqldrivers
                    qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/MYSQL/MySQL Server <version>/lib/opt"
                    nmake sub-mysql
                    If you are not using a Microsoft compiler, replace nmake with mingw32-make in the line above.
                    

                    I'll test your suggestion shortly.
                    Cheers,
                    Cedric

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

                      I think you may have misread the documentation.

                      There are two variables: MYSQL_INCDIR and MYSQL_LIBDIR.

                      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
                      2
                      • C Offline
                        C Offline
                        cdwijs
                        wrote on last edited by
                        #13

                        I see it now, I indeed only typed halve of the command.
                        Thanks, I can now test it further.

                        Cheers,
                        Cedric

                        1 Reply Last reply
                        0
                        • Cobra91151C Offline
                          Cobra91151C Offline
                          Cobra91151
                          wrote on last edited by Cobra91151
                          #14

                          Hello! Do you have libs included in your .pro file?

                          contains(QMAKE_TARGET.arch, x86_64) {
                              LIBS += -L"C:/MySQL/mysql-5.7.22-winx64/lib" -llibmysql
                          } else {
                              LIBS += -L"C:/MySQL/mysql-5.7.22-win32/lib" -llibmysql
                          }
                          

                          Note that you need to download the MySQL from here MySQL Community Server and extract the data for example to C drive. Also I suggest to copy libmysql.dll to the application directory.

                          I use Qt 5.9.6 and Visual Studio 2017 compiler and it doesn't require to build the driver for MySQL.

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            cdwijs
                            wrote on last edited by
                            #15

                            Hi All,

                            I'm one step closer to my goal, I can now build the plugin. I cannot yet connect to my database.
                            Steps I've taken:

                            1. Download and install https://downloads.mysql.com/archives/get/file/mysql-connector-c-6.1.11-win32.msi
                            2. Add C:\Qt\Tools\mingw530_32\bin and C:\Qt\5.10.1\mingw53_32\bin to the path
                            3. Open cmd.exe, and enter the following commands:
                            c:\Qt\5.10.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" MYSQL_LIBDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1"\lib
                            
                            Running configuration tests...
                            Checking for DB2 (IBM)... no
                            Checking for InterBase... no
                            Checking for MySQL... yes
                            Checking for OCI (Oracle)... no
                            Checking for ODBC... yes
                            Checking for PostgreSQL... no
                            Checking for SQLite (version 2)... no
                            Checking for TDS (Sybase)... no
                            Done running configuration tests.
                            
                            Configure summary:
                            
                            Qt Sql:
                              DB2 (IBM) .............................. no
                              InterBase .............................. no
                              MySql .................................. yes
                              OCI (Oracle) ........................... no
                              ODBC ................................... yes
                              PostgreSQL ............................. no
                              SQLite2 ................................ no
                              SQLite ................................. yes
                                Using system provided SQLite ......... no
                              TDS (Sybase) ........................... no
                            
                            Qt is now configured for building. Just run 'mingw32-make'.
                            Once everything is built, Qt is installed.
                            You should NOT run 'mingw32-make install'.
                            Note that this build cannot be deployed to other machines or devices.
                            
                            Prior to reconfiguration, make sure you remove any leftovers from
                            the previous build.
                            
                            mingw32-make
                            
                            <<lots of text>>
                            
                            1. Create a new Qt program, with the following options:
                              Qt widgets application
                              Name: sqlTest
                              Kit: Desktop Qt 5.11.1 MinGB 32 bit (default)
                              ClassName: (MainWindow) (default)
                              Version control: Git

                            mysql.pro

                            QT       += core gui sql
                            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                            TARGET = sqlTest
                            TEMPLATE = app
                            DEFINES += QT_DEPRECATED_WARNINGS
                            SOURCES += \
                                    main.cpp \
                                    mainwindow.cpp
                            HEADERS += \
                                    mainwindow.h
                            FORMS += \
                                    mainwindow.ui
                            

                            mainwindow.cpp

                            #include "mainwindow.h"
                            #include "ui_mainwindow.h"
                            #include <QtSql>
                            #include <QDebug>
                            MainWindow::MainWindow(QWidget *parent) :
                                QMainWindow(parent),
                                ui(new Ui::MainWindow)
                            {
                                ui->setupUi(this);
                            
                                QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
                               db.setHostName("localhost");
                               db.setDatabaseName("world");
                               db.setUserName("root");
                               db.setPassword("PassOlyForForumQuestion");
                               bool ok = db.open();
                               qDebug()<<ok;
                            }
                            
                            MainWindow::~MainWindow()
                            {
                                delete ui;
                            }
                            

                            Program output:

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

                            Cheers,
                            Cedric

                            H H 2 Replies Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #16

                              Did you install the plugin ?

                              Did you also check that the PATH environment variable in the Run part of the Project panel contains the folder where the MySQL .dlls can be found ?

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

                              C 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Did you install the plugin ?

                                Did you also check that the PATH environment variable in the Run part of the Project panel contains the folder where the MySQL .dlls can be found ?

                                C Offline
                                C Offline
                                cdwijs
                                wrote on last edited by cdwijs
                                #17

                                How can I install the plugin? Where can the plugin be found? What does it look like? Where does Qt look for the plugin?

                                Why does the Qt runtime tell me the QMYSQL driver is available while the driver cannot be loaded? Is there any way to see why the driver did not load?

                                Is there a guide anywhere that works with the current version of myqsl and the current version of Qt? This guide is for mysql version 5.1: https://forum.qt.io/topic/40672/how-to-create-the-plugin-of-mysql-for-qt

                                Am I the first one that tries to use Qt 5 and mysql server 8?

                                Cheers,
                                Cedric

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

                                  It's explained in the documentation
                                  In the plugins subfolder of your Qt installation under sqldrivers.
                                  It's a .dll file since you're on Windows.
                                  Qt looks for the plugins in the subfolder named plugins unless you tweaked the qt.conf file.

                                  Likely because it can find the plugin but will fail to load it. Most of the time it happens because the MySQL .dll files can't be found at run time hence my suggestion in my last post.

                                  The current Qt documentation does.

                                  No you're note, however MySQL server 8 saw a change in their support for their my_bool custom type. There's a patch to support build the Qt MySQL plugin with MySQL 8.

                                  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
                                  1
                                  • C Offline
                                    C Offline
                                    cdwijs
                                    wrote on last edited by
                                    #19

                                    Thanks for your reply.

                                    The documentation you linked (http://doc.qt.io/qt-5/sql-driver.html#building-the-drivers) assumes mysql is installed in c:\mysql. This is not the case for a default installation of mysql8, as it installs itself into c:\program files and c:\program files (x86). This leads me to the conclusion that the install instructions on that page are outdated.

                                    Do you know any instructions for building the plugin for qt5 and mysql 8?

                                    Cheers,
                                    Cedric

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

                                      The doc says:

                                      You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MySQL):
                                      

                                      This simply means that it assumes that the user selected that folder to install MySQL.

                                      Then:

                                      cd %QTDIR%\qtbase\src\plugins\sqldrivers
                                      qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/MYSQL/MySQL Server <version>/lib/opt"
                                      nmake sub-mysql
                                      

                                      It shows that the build is configured to use that folder.

                                      If you put MySQL somewhere else, update the command accordingly to use that folder.

                                      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
                                      3
                                      • C Offline
                                        C Offline
                                        cdwijs
                                        wrote on last edited by
                                        #21

                                        I have done the steps again:
                                        c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" MYSQL_LIBDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1"\lib
                                        and
                                        mingw32-make

                                        After this, there's no mysql.dll below C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers (in fact, there's no mysql.dll on my entire C:\ drive)

                                        However, this directory is newly created:
                                        C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\plugins\sqldrivers
                                        it contains the following files: (and a few extra files with sqlite in the name)
                                        qsqlmysql.dll
                                        qsqlmysqld.dll
                                        qsqlodbc.dll
                                        qsqlodbcd.dll

                                        Where do I put these?

                                        Cheers,
                                        Cedric

                                        jsulmJ L 2 Replies Last reply
                                        0
                                        • C cdwijs

                                          I have done the steps again:
                                          c:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" MYSQL_LIBDIR="c:\Program Files (x86)\MySQL\MySQL Connector C 6.1"\lib
                                          and
                                          mingw32-make

                                          After this, there's no mysql.dll below C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers (in fact, there's no mysql.dll on my entire C:\ drive)

                                          However, this directory is newly created:
                                          C:\Qt\5.11.1\Src\qtbase\src\plugins\sqldrivers\plugins\sqldrivers
                                          it contains the following files: (and a few extra files with sqlite in the name)
                                          qsqlmysql.dll
                                          qsqlmysqld.dll
                                          qsqlodbc.dll
                                          qsqlodbcd.dll

                                          Where do I put these?

                                          Cheers,
                                          Cedric

                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #22

                                          @cdwijs You forgot

                                          mingw32-make install
                                          

                                          as shown in the documentation...

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

                                          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