Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work



  • @Christian-Ehrlicher

    for sorry it didn't work either

    the stpes i made open Qt 5.15.1 (MinGW 8.1.0 32-bit) ( ididnt use cmd at all )
    because here is using cmd :https://forum.qt.io/topic/92626/cant-connect-to-mysql-database-qmysql-driver-not-loaded/17

    D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="D:\Connect
    or C++ 8.0\include" MYSQL_LIBDIR="D:\Connector C++ 8.0\lib"
    
    Running configuration tests...
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      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, you must run 'mingw32-make install'.
    Qt will be installed into 'D:\Qt\5.15.1\mingw81_32'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    and this is output of the software

    ("QSQLITE", "QODBC", "QODBC3", "QPSQL", "QPSQL7")
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
    "Driver not loaded Driver not loaded"
    

    this forum didn't work at all :https://forum.qt.io/topic/40672/how-to-create-the-plugin-of-mysql-for-qt
    , but i downloaded mingw utilities and extract it in mingw81-32/bin


  • Lifetime Qt Champion

    @MostafaEzzat said in MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work:

    MySql .................................. no

    The third time: Please follow the documentation!

    As you can see mysql was not configured, so take a look at config.log why this is the case. It's all written in the documentation.



  • @Christian-Ehrlicher said in MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work:

    As you can see mysql was not configured, so take a look at config.log why this is the case. It's all written in the documentation.

    excuse me for annoying ,

    i open config file gives me this that mysql_config not found and otherfiles however i installed mysql succcesfully so what should i do

    Command line: "MYSQL_INCDIR=D:\Connector C++ 8.0\include" "MYSQL_LIBDIR=D:\Connector C++ 8.0\lib"
    Global lib dirs: [C:\\openssl\\lib C:\\Utils\\my_sql\\mysql-5.7.25-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib] [D:/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0 D:/Qt/Tools/mingw810_32/lib/gcc D:/Qt/Tools/mingw810_32/i686-w64-mingw32/lib D:/Qt/Tools/mingw810_32/lib]
    Global inc dirs: [C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-win32\\include C:\\Utils\\postgresql\\pgsql\\include] [D:/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++ D:/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/i686-w64-mingw32 D:/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include/c++/backward D:/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include D:/Qt/Tools/mingw810_32/lib/gcc/i686-w64-mingw32/8.1.0/include-fixed D:/Qt/Tools/mingw810_32/i686-w64-mingw32/include]
    looking for library db2
    Trying source 0 (type inline) of library db2 ...
    sqlcli.h not found in [] and global paths.
    sqlcli1.h not found in [] and global paths.
      => source produced no result.
    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 ...
    ibase.h not found in [] and global paths.
      => source produced no result.
    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 D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && D:\Qt\5.15.1\mingw81_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.7.25-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = \"-LD:\\Connector C++ 8.0\\lib\" -llibmariadb" "QMAKE_INCDIR_MYSQL = \"D:\\Connector C++ 8.0\\include\"" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    + cd /d D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
    > del main.o
    > Could Not Find D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql\main.o
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-win32\include -IC:\Utils\postgresql\pgsql\include -I"D:\Connector C++ 8.0\include" -ID:\Qt\5.15.1\mingw81_32\mkspecs\win32-g++  -o main.o main.cpp
    > In file included from D:\Connector C++ 8.0\include/mysql.h:80,
    >                  from main.cpp:5:
    > D:\Connector C++ 8.0\include/mysql_com.h:1034:10: fatal error: mysql/udf_registration_types.h: No such file or directory
    >  #include "mysql/udf_registration_types.h"
    >           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > compilation terminated.
    > mingw32-make: *** [Makefile:454: main.o] Error 1
     => source failed verification.
    Trying source 6 (type inline) of library mysql ...
    + cd /d D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && D:\Qt\5.15.1\mingw81_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.7.25-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = \"-LD:\\Connector C++ 8.0\\lib\" -llibmysql" "QMAKE_INCDIR_MYSQL = \"D:\\Connector C++ 8.0\\include\"" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    + cd /d D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
    > del main.o
    > Could Not Find D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql\main.o
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-win32\include -IC:\Utils\postgresql\pgsql\include -I"D:\Connector C++ 8.0\include" -ID:\Qt\5.15.1\mingw81_32\mkspecs\win32-g++  -o main.o main.cpp
    > In file included from D:\Connector C++ 8.0\include/mysql.h:80,
    >                  from main.cpp:5:
    > D:\Connector C++ 8.0\include/mysql_com.h:1034:10: fatal error: mysql/udf_registration_types.h: No such file or directory
    >  #include "mysql/udf_registration_types.h"
    >           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > compilation terminated.
    > mingw32-make: *** [Makefile:454: main.o] Error 1
     => source failed verification.
    Trying source 7 (type inline) of library mysql ...
      => source failed condition '!config.win32'.
    Trying source 8 (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 ...
    oci.h not found in [] and global paths.
      => source produced no result.
    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 D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && D:\Qt\5.15.1\mingw81_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.7.25-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += odbc" "QMAKE_LIBS_ODBC = -lodbc32" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc
    + cd /d D:\Qt\5.15.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 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-win32\include -IC:\Utils\postgresql\pgsql\include -ID:\Qt\5.15.1\mingw81_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.7.25-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 ...
    libpq-fe.h not found in [] and global paths.
      => source produced no result.
    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 ...
    sqlite.h not found in [] and global paths.
      => source produced no result.
    test config.sqldrivers.libraries.sqlite2 FAILED
    looking for library tds
    Trying source 0 (type sybaseEnv) of library tds ...
    + cd /d D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && D:\Qt\5.15.1\mingw81_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.7.25-win32\\lib C:\\Utils\\postgresql\\pgsql\\lib" "INCLUDEPATH += C:\\openssl\\include C:\\Utils\\my_sql\\mysql-5.7.25-win32\\include C:\\Utils\\postgresql\\pgsql\\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    + cd /d D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make
    > del main.o
    > Could Not Find D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.o
    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-win32\include -IC:\Utils\postgresql\pgsql\include -ID:\Qt\5.15.1\mingw81_32\mkspecs\win32-g++  -o main.o main.cpp
    > main.cpp:2:10: fatal error: sybfront.h: No such file or directory
    >  #include <sybfront.h>
    >           ^~~~~~~~~~~~
    > compilation terminated.
    > mingw32-make: *** [Makefile:446: 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
    
    

    this 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 ..." "sqlcli.h not found in [] and global paths." "sqlcli1.h not found in [] and global paths." "  => source produced no result." "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 ..." "ibase.h not found in [] and global paths." "  => source produced no result." "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 D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql && D:\\Qt\\5.15.1\\mingw81_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.7.25-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.7.25-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"QMAKE_USE += mysql\" \"QMAKE_LIBS_MYSQL = \\\"-LD:\\\\Connector C++ 8.0\\\\lib\\\" -llibmariadb\" \"QMAKE_INCDIR_MYSQL = \\\"D:\\\\Connector C++ 8.0\\\\include\\\"\" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql" "+ cd /d D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.7.25-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -I\"D:\\Connector C++ 8.0\\include\" -ID:\\Qt\\5.15.1\\mingw81_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> In file included from D:\\Connector C++ 8.0\\include/mysql.h:80," ">                  from main.cpp:5:" "> D:\\Connector C++ 8.0\\include/mysql_com.h:1034:10: fatal error: mysql/udf_registration_types.h: No such file or directory" ">  $${LITERAL_HASH}include \"mysql/udf_registration_types.h\"" ">           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "> compilation terminated." "> mingw32-make: *** [Makefile:454: main.o] Error 1" " => source failed verification." "Trying source 6 (type inline) of library mysql ..." "+ cd /d D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql && D:\\Qt\\5.15.1\\mingw81_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.7.25-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.7.25-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"QMAKE_USE += mysql\" \"QMAKE_LIBS_MYSQL = \\\"-LD:\\\\Connector C++ 8.0\\\\lib\\\" -llibmysql\" \"QMAKE_INCDIR_MYSQL = \\\"D:\\\\Connector C++ 8.0\\\\include\\\"\" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql" "+ cd /d D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\mysql\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.7.25-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -I\"D:\\Connector C++ 8.0\\include\" -ID:\\Qt\\5.15.1\\mingw81_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> In file included from D:\\Connector C++ 8.0\\include/mysql.h:80," ">                  from main.cpp:5:" "> D:\\Connector C++ 8.0\\include/mysql_com.h:1034:10: fatal error: mysql/udf_registration_types.h: No such file or directory" ">  $${LITERAL_HASH}include \"mysql/udf_registration_types.h\"" ">           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "> compilation terminated." "> mingw32-make: *** [Makefile:454: main.o] Error 1" " => source failed verification." "Trying source 7 (type inline) of library mysql ..." "  => source failed condition \'!config.win32\'." "Trying source 8 (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 ..." "oci.h not found in [] and global paths." "  => source produced no result." "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 D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\odbc && D:\\Qt\\5.15.1\\mingw81_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.7.25-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.7.25-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"QMAKE_USE += odbc\" \"QMAKE_LIBS_ODBC = -lodbc32\" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc" "+ cd /d D:\\Qt\\5.15.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 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.7.25-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -ID:\\Qt\\5.15.1\\mingw81_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.7.25-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 ..." "libpq-fe.h not found in [] and global paths." "  => source produced no result." "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 ..." "sqlite.h not found in [] and global paths." "  => source produced no result."
    cache.tds._KEYS_ = result msgs
    cache.tds.result = false
    cache.tds.msgs = "Trying source 0 (type sybaseEnv) of library tds ..." "+ cd /d D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\tds && D:\\Qt\\5.15.1\\mingw81_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.7.25-win32\\\\lib C:\\\\Utils\\\\postgresql\\\\pgsql\\\\lib\" \"INCLUDEPATH += C:\\\\openssl\\\\include C:\\\\Utils\\\\my_sql\\\\mysql-5.7.25-win32\\\\include C:\\\\Utils\\\\postgresql\\\\pgsql\\\\include\" \"QMAKE_USE += tds\" \"QMAKE_LIBS_TDS = -lNTWDBLIB\" D:/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers/config.tests/tds" "+ cd /d D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make" "> del main.o" "> Could Not Find D:\\Qt\\5.15.1\\Src\\qtbase\\src\\plugins\\sqldrivers\\config.tests\\tds\\main.o" "> g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -I. -IC:\\openssl\\include -IC:\\Utils\\my_sql\\mysql-5.7.25-win32\\include -IC:\\Utils\\postgresql\\pgsql\\include -ID:\\Qt\\5.15.1\\mingw81_32\\mkspecs\\win32-g++  -o main.o main.cpp" "> main.cpp:2:10: fatal error: sybfront.h: No such file or directory" ">  $${LITERAL_HASH}include <sybfront.h>" ">           ^~~~~~~~~~~~" "> compilation terminated." "> mingw32-make: *** [Makefile:446: main.o] Error 1" " => source failed verification." "Trying source 1 (type sybaseEnv) of library tds ..." "  => source failed condition \'!config.win32\'."
    
    

  • Lifetime Qt Champion

    @MostafaEzzat said in MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work:

    D:\Connector C++ 8.0\include/mysql_com.h:1034:10: fatal error: mysql/udf_registration_types.h: No such file or directory
    #include "mysql/udf_registration_types.h"

    Read the logs.



  • @Christian-Ehrlicher

    i changed to mariadb because mysql client has alot of missing files

    so i used

    D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MariaDB 10.0\include\mysql" MYSQL_LIBDIR="C:\Program Files (x86)\MariaDB 10.0\lib"
     
    and MYSql detected 
    then 
    mingw32-make sub-mysql
    then 
    mingw32-make install
    

    and everything went very well

    and i copied
    qsqlmysql4.dll
    qsqlmysql.dl
    libqsqlmysql.a

    to dir D:\Qt\5.15.1\mingw81_32\bin

    i test the software get

    QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    QSqlDatabasePrivate::addDatabase: duplicate connection name 'SecConnection', old connection removed.
    Donnne
    "Driver not loaded Driver not loaded"
    
    

    i have these files in D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers\plugins\sqldrivers

    adadsd.PNG

    in this piece of code

    Databas =   QSqlDatabase::addDatabase("QMYSQL", "SecConnection");
    

    or this

        Databas =   QSqlDatabase::addDatabase("QMARIADB", "SecConnection");
    
    

    it gives me "Driver not loaded Driver not loaded"

    when i use QODBC or QSQLITE

    it loads successfully

    so where is the problem i just want the diver to load and how to make it recognize Mariadb only

    Thanks in advance



  • @MostafaEzzat said in MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work:

    qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MariaDB 10.0\include\mysql" MYSQL_LIBDIR="C:\Program Files (x86)\MariaDB 10.0\lib"

    Setting up environment for Qt usage...
    
    D:\Qt\5.15.1\mingw81_32>cd D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers
    
    D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:\Program
     Files (x86)\MariaDB 10.0\include\mysql" MYSQL_LIBDIR="C:\Program Files (x86)\Ma
    riaDB 10.0\lib"
    
    Running configuration tests...
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      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, you must run 'mingw32-make install'.
    Qt will be installed into 'D:\Qt\5.15.1\mingw81_32'.
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    
    D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers>
    

    this's the command result for sure after that i used

    mingw32-make sub-mysql
    mingw32-make install
    


  • @MostafaEzzat
    If you are having a "Driver not loaded" and don't know why, run your executable with environment variable QT_DEBUG_PLUGINS=1 for diagnostic information.



  • @JonB

    Sorry where should i put this variable QT_DEBUG_PLUGINS=1

    do you mean by the environment .pro file ? or Options in qtcreator


  • Lifetime Qt Champion

    @MostafaEzzat If you start from QtCreator then set it under "Projects/Build & Run/Run/Run Environment"



  • @jsulm

    ok i went to Build Enviroment and added it , this output it seems it doesn't search for any sql plugins even he didn't search in

    qtbase/src/plugins/sqldrivers
    
    14:27:19: Starting C:\Users\Mostafa\Downloads\HospitalSoftware Last Version\build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug\debug\Hospital-ClinicSoftware.exe ...
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/platforms/qdirect2d.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/platforms/qdirect2d.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "direct2d"
            ]
        },
        "archreq": 0,
        "className": "QWindowsDirect2DIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("direct2d")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/platforms/qminimal.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/platforms/qminimal.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 0,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/platforms/qoffscreen.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/platforms/qoffscreen.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 0,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/platforms/qwindows.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/platforms/qwindows.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "windows"
            ]
        },
        "archreq": 0,
        "className": "QWindowsIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("windows")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/platforms" ...
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/platforms/qwindows.dll"
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/platformthemes" ...
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/platformthemes/qxdgdesktopportal.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/platformthemes/qxdgdesktopportal.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "xdgdesktopportal",
                "flatpak",
                "snap"
            ]
        },
        "archreq": 0,
        "className": "QXdgDesktopPortalThemePlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/platformthemes" ...
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/styles" ...
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/styles/qwindowsvistastyle.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/styles/qwindowsvistastyle.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QStyleFactoryInterface",
        "MetaData": {
            "Keys": [
                "windowsvista"
            ]
        },
        "archreq": 0,
        "className": "QWindowsVistaStylePlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("windowsvista")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/styles" ...
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/styles/qwindowsvistastyle.dll"
    DEBUG
    WARNING
    hello from showingdata
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/iconengines" ...
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/iconengines/qsvgicon.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/iconengines/qsvgicon.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz",
                "svg.gz"
            ]
        },
        "archreq": 0,
        "className": "QSvgIconPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("svg", "svgz", "svg.gz")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/iconengines" ...
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/imageformats" ...
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qgif.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qgif.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "gif"
            ],
            "MimeTypes": [
                "image/gif"
            ]
        },
        "archreq": 0,
        "className": "QGifPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("gif")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qicns.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qicns.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "icns"
            ],
            "MimeTypes": [
                "image/x-icns"
            ]
        },
        "archreq": 0,
        "className": "QICNSPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("icns")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qico.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qico.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "ico",
                "cur"
            ],
            "MimeTypes": [
                "image/vnd.microsoft.icon",
                "image/vnd.microsoft.icon"
            ]
        },
        "archreq": 0,
        "className": "QICOPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("ico", "cur")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qjpeg.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qjpeg.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "jpg",
                "jpeg"
            ],
            "MimeTypes": [
                "image/jpeg",
                "image/jpeg"
            ]
        },
        "archreq": 0,
        "className": "QJpegPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("jpg", "jpeg")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qsvg.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qsvg.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "svg",
                "svgz"
            ],
            "MimeTypes": [
                "image/svg+xml",
                "image/svg+xml-compressed"
            ]
        },
        "archreq": 0,
        "className": "QSvgPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("svg", "svgz")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qtga.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qtga.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tga"
            ],
            "MimeTypes": [
                "image/x-tga"
            ]
        },
        "archreq": 0,
        "className": "QTgaPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("tga")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qtiff.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qtiff.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "tiff",
                "tif"
            ],
            "MimeTypes": [
                "image/tiff",
                "image/tiff"
            ]
        },
        "archreq": 0,
        "className": "QTiffPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("tiff", "tif")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qwbmp.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qwbmp.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "wbmp"
            ],
            "MimeTypes": [
                "image/vnd.wap.wbmp"
            ]
        },
        "archreq": 0,
        "className": "QWbmpPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("wbmp")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qwebp.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qwebp.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
        "MetaData": {
            "Keys": [
                "webp"
            ],
            "MimeTypes": [
                "image/webp"
            ]
        },
        "archreq": 0,
        "className": "QWebpPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("webp")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/imageformats" ...
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qgif.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qicns.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qico.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qjpeg.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qsvg.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qtga.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qtiff.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qwbmp.dll"
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/imageformats/qwebp.dll"
    QFactoryLoader::QFactoryLoader() checking directory path "D:/Qt/5.15.1/mingw81_32/plugins/accessiblebridge" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/accessiblebridge" ...
    

  • Lifetime Qt Champion

    @MostafaEzzat I don't see it trying to load any SQL drivers. Do you have anything in plugins/sqldrivers directory of your Qt installation?

    By the way: it should NOT search in qtbase/src/plugins/sqldrivers as that is source code directory, it should search in D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers



  • @jsulm

    i copied qsqlmysql4.dll into D:\Qt\5.15.1\mingw81_32\plugins\sqldrivers

    and i got this

    should i copy qtbase/src/plugins/sqldrivers into D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers files into

     
    
    Got keys from plugin meta data ("QODBC3", "QODBC")
    QFactoryLoader::QFactoryLoader() looking at "D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers/qsqlpsql.dll"
    Found metadata in lib D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers/qsqlpsql.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
        "MetaData": {
            "Keys": [
                "QPSQL7",
                "QPSQL"
            ]
        },
        "archreq": 0,
        "className": "QPSQLDriverPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/sqldrivers" ...
    ("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")
    Cannot load library D:\Qt\5.15.1\mingw81_32\plugins\sqldrivers\qsqlmysql.dll: Unknown error 0x000000c1.
    QLibraryPrivate::loadPlugin failed on "D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library D:\\Qt\\5.15.1\\mingw81_32\\plugins\\sqldrivers\\qsqlmysql.dll: Unknown error 0x000000c1."
    QSqlDatabase: QMARIADB driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMARIADB QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    Donnne
    "Driver not loaded Driver not loaded"
    not Connected
    QSqlQuery::exec: database not open
    

  • Lifetime Qt Champion



  • @jsulm

    neither QMARIADB nor QMYSQL both don't load

    and i copied it from qtbase/src/plugins/sqldrivers
    the path where i used

    D:\Qt\5.15.1\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:\Program Files (x86)\MariaDB 10.0\include\mysql" MYSQL_LIBDIR="C:\Program Files (x86)\MariaDB 10.0\lib"
    
    

  • Lifetime Qt Champion

    @MostafaEzzat It still looks like you DO not follow the documentation (https://doc.qt.io/qt-5/sql-driver.html#building-the-drivers): after building you need to do "make install", that will copy the DLLs to your Qt installation.
    Also, are you sure you used the correct qmake to build the plug-ins? I'm asking because you used qmake without absolute path.


  • Lifetime Qt Champion

    @jsulm said in MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work:

    I'm asking because you used qmake without absolute path.

    And because the plugin name is wrong - the '4' looks suspicious.



  • @jsulm

    i did use

    mingw32-make sub-mysql
    
    then
    
    mingw32-make install
    

    but i'm not sure i use the right path because i was running this software on linux before
    but this my .pro file
    should i change the path from .pro file or options

    #-------------------------------------------------
    #
    # Project created by QtCreator 2018-12-24T22:54:39
    #
    #-------------------------------------------------
    #
    
    QT  += core gui sql
     greaterThan(QT_MAJOR_VERSION, 4): QT += widgets designer
    
    TARGET = Hospital-ClinicSoftware
    TEMPLATE += app lib libs
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which has been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    
    
    CONFIG += c++11 designer plugins plugin
    
    SOURCES += \
            main.cpp \
            mainwindow.cpp \
        mainprocess.cpp \
        mysqldatabase.cpp \
        showingdata.cpp \
        delgate.cpp \
        profile3.cpp \
        profile.cpp \
       multipagewidget.cpp \
        multipagewidgetplugin.cpp \
        multipagewidgetcontainerextension.cpp \
         multipagewidgetextensionfactory.cpp \
    
    
        mysqldatabase.cpp
    
    HEADERS += \
             mainwindow.h \
        mainprocess.h \
        showingdata.h \
        delgate.h \
        profile3.h \
        profile.h \
        multipagewidget.h \
                  multipagewidgetplugin.h \
                  multipagewidgetcontainerextension.h \
                  multipagewidgetextensionfactory.h \
        mysqldatabase.h
    
    
    
    FORMS += \
         mainwindow.ui \
        mainprocess.ui \
        showingdata.ui \
        profile3.ui \
        profile.ui
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path += /opt/$${TARGET}/bin $$[QT_INSTALL_PLUGINS]/designer
    !isEmpty(target.path): INSTALLS += target
    
    

  • Lifetime Qt Champion

    @MostafaEzzat You should call qmake using whole path to make sure you use the one from the Qt version you're building for.



  • @jsulm

    such a weird thing , i didn't know that i should copy libmysql.dll to D:\Qt\5.15.1\mingw81_32\plugins\sqldrivers

    i only copied to mingw81_32/bin

    now it's working

    Got keys from plugin meta data ("QPSQL7", "QPSQL")
    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/sqldrivers" ...
    ("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")
    loaded library "D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers/qsqlmysql.dll"
    Donnne
    Connected
    

    Thank you guys i do love this community


  • Lifetime Qt Champion

    @MostafaEzzat Yes, plug-ins are somewhat special: they are expected to be in a specific location and are loaded at runtime.


Log in to reply