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

QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL



  • hi there,
    i need help i just cant figure it out.
    i almost tried everything out here is my code:
    #include "login.h"
    #include "ui_login.h"

    Login::Login(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::Login)
    {

    ui->setupUi(this);
    QGraphicsScene scene;
    QPixmap pixmap(":/logo.jpg");
    scene.addPixmap(pixmap);
    ui->graphicsView->setScene(&scene);
    QSqlDatabase Logindb=QSqlDatabase::addDatabase("QMYSQL");
    Logindb.setHostName("127.0.0.1");
    Logindb.setPort(3306);
    Logindb.setDatabaseName("agr_kako");
    Logindb.setUserName("root");
    Logindb.setPassword("1234");
    Logindb.open();
    
    if(!Logindb.open())
    {ui->label_3->setText("Failed to open the database");}
    else
        ui->label_3->setText("Connected");
    

    }

    Login::~Login()
    {
    delete ui;
    }

    void Login::on_pushButton_signin_clicked()
    {

    Logindb.open();
    QString username,passwort;
    username=ui->lineEdit_User->text();
    passwort=ui->lineEdit_Password->text();
    

    // QSqlQuery qry;
    // if(qry.exec("select * from login where Nachname='"+username+"'and Passwort'"+passwort+"'"))
    // {
    // int count=0;
    // while(qry.next())
    // {
    // count++;
    // }
    // if(count==1)
    // ui->label_3->setText("Login erfolgreich");
    // if(count>1)
    // ui->label_3->setText("");
    // if(count==1)
    // ui->label_3->setText("Login fehlgeschlagen Passwort oder Name falsch");
    // }
    // if(!Logindb.isOpen())
    // {
    // qDebug()<<"Verbindung zur Datenbank verloren";
    // return;
    // }

    parameter=new Parameter(this);
    parameter->show();
    hide();
    

    }
    and here is my output:
    10:48:54: Starte E:\qtprojekts\build-AGR-KAKO-Desktop_Qt_5_15_0_MinGW_64_bit-Debug\debug\sqlTest.exe ...
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

    my database is a localhost mariadb wich is called agr_kako and the table is called login and has 2 names in it.


  • Lifetime Qt Champion

    @JonnyQB Please search in the forum for mysql issues. This is asked very often and was discussed many times.



  • @jsulm yeah i looked already but alll solutions couldn´t help me out


  • Lifetime Qt Champion

    @JonnyQB What did you try? Most probably you do not have MySQL client libs.
    Set QT_DEBUG_PLUGINS (https://doc.qt.io/qt-5/deployment-plugins.html) before starting your app, then start your app and check the output.



  • E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C++ 8.0/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL 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 ................................... no
    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 'E:\Programme\qt\Tools\5.15.0\mingw81_64'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    i tried building but now i got this....


  • Lifetime Qt Champion

    @JonnyQB What compiler do you use?
    Also, you can check config.log file to see why MySql was disabled.



  • @jsulm
    i use mingw81_64
    wich config.log do you mean and where could i find it


  • Lifetime Qt Champion

    @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    wich config.log do you mean and where could i find it

    In the build folder (from where you called qmake)



  • @jsulm
    i got this
    Trying source 1 (type inline) of library odbc ...
    => source failed condition 'config.darwin'.
    Trying source 2 (type inline) of library odbc ...
    => source failed condition '!config.win32 && !config.darwin'.
    test config.sqldrivers.libraries.odbc FAILED
    loaded result for library config.sqldrivers.libraries.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
    loaded result for library config.sqldrivers.libraries.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
    loaded result for library config.sqldrivers.libraries.tds
    Trying source 0 (type sybaseEnv) of library tds ...

    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
      Project ERROR: Cannot run compiler 'g++'. Output:
      ===================
      ===================
      Maybe you forgot to setup the environment?
      => source failed verification.
      Trying source 1 (type sybaseEnv) of library tds ...
      => source failed condition '!config.win32'.
      test config.sqldrivers.libraries.tds FAILED

    what should i do


  • Lifetime Qt Champion

    @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    what should i do

    make sure you open the correct Qt command prompt where a g++ compiler is available.



  • @JonnyQB you could use my precompiled QMYSQL driver from https://github.com/thecodemonkey86/qt_mysql_driver if you like. I tested it with MariaDB as well



  • @Christian-Ehrlicher
    i set the path to both files like in the doc from qt.



  • @Christian-Ehrlicher
    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C++ 8.0/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL 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 ................................... no
    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 'E:\Programme\qt\Tools\5.15.0\mingw81_64'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>where g++
    E:\Programme\qt\Tools\mingw810_64\bin\g++.exe

    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>where gcc
    E:\Programme\qt\Tools\mingw810_64\bin\gcc.exe



  • Hi, just to check, remember to remove the config.cache file before you run configure. This is easy to forget (I did :-) here's an answer from a previous, similar discussion:

    @Bonnie said in Set-up MariaDB library file location programmatically?:

    @SPlatten
    It is actually in the doc:

    If something goes wrong and you want qmake to recheck your available drivers, you must remove config.cache in <QTDIR>/qtbase/src/plugins/sqldrivers - otherwise qmake will not search for the available drivers again.

    I think the doc should make that sentence more sight-catching.
    Many people who had their first qmake command unsuccessful would be stucked there, with a never-changing config.log.


  • Lifetime Qt Champion

    @hskoglund next release of the documentation shall have that modification :-)



  • @hskoglund

    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C++ 8.0/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C++ 8.0//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.

    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 'E:\Programme\qt\Tools\5.15.0\mingw81_64'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    but i still get this
    and i need mysql ....



  • @jsulm
    Command line: "MYSQL_INCDIR=C:/Program Files/MySQL/MySQL Connector C++ 8.0/include" "MYSQL_LIBDIR=C:/Program Files/MySQL/MySQL Connector C++ 8.0//lib"
    Global lib dirs: [C:\openssl\lib C:\Utils\my_sql\mysql-5.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib] [E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc E:/Programme/qt/Tools/Tools/mingw810_64/x86_64-w64-mingw32/lib E:/Programme/qt/Tools/Tools/mingw810_64/lib]
    Global inc dirs: [C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include] [E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed E:/Programme/qt/Tools/Tools/mingw810_64/x86_64-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 ...
    mysql.h not found in ["C:/Program Files/MySQL/MySQL Connector C++ 8.0/include"] and global paths.
    => source produced no result.
    Trying source 6 (type inline) of library mysql ...
    mysql.h not found in ["C:/Program Files/MySQL/MySQL Connector C++ 8.0/include"] and global paths.
    => source produced no result.
    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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += odbc" "QMAKE_LIBS_ODBC = -lodbc32" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc
    • cd /d E:\Programme\qt\Tools\5.15.0\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-winx64\include -IC:\Utils\postgresql\pgsql\include -IE:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make

    del main.o
    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.o konnte nicht gefunden werden
    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-winx64\include -IC:\Utils\postgresql\pgsql\include -IE:\Programme\qt\Tools\5.15.0\mingw81_64\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:498: 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

    and this is the config ...


  • Lifetime Qt Champion

    @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    mysql.h not found in ["C:/Program Files/MySQL/MySQL Connector C++ 8.0/include"]

    So is your mysql.h in this directory or did you install it in another place?



  • @Christian-Ehrlicher
    i tried 2 seperate connectsUnbenannt.PNG


  • Lifetime Qt Champion

    @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    C:/Program Files/MySQL/MySQL Connector C++ 8.0/include

    So why do you pass the wrong path to qmake then??



  • @Christian-Ehrlicher
    i tried both pathes because i wanted to eleminate other faults
    i also made the qmake call with the mariaDb connector



  • @Christian-Ehrlicher
    @jsulm
    now what should i do ?


  • Lifetime Qt Champion

    @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    i tried both pathes because i wanted to eleminate other faults

    Then show the correct log ... really that hard?



  • @Christian-Ehrlicher
    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MariaDB/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MariaDB/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.

    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 'E:\Programme\qt\Tools\5.15.0\mingw81_64'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>

    Command line: "MYSQL_INCDIR=C:/Program Files/MySQL/MariaDB/include" "MYSQL_LIBDIR=C:/Program Files/MySQL/MariaDB/lib"
    Global lib dirs: [C:\openssl\lib C:\Utils\my_sql\mysql-5.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib] [E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc E:/Programme/qt/Tools/Tools/mingw810_64/x86_64-w64-mingw32/lib E:/Programme/qt/Tools/Tools/mingw810_64/lib]
    Global inc dirs: [C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include] [E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed E:/Programme/qt/Tools/Tools/mingw810_64/x86_64-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 ...
    mysql.h not found in ["C:/Program Files/MySQL/MariaDB/include"] and global paths.
    => source produced no result.
    Trying source 6 (type inline) of library mysql ...
    mysql.h not found in ["C:/Program Files/MySQL/MariaDB/include"] and global paths.
    => source produced no result.
    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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += odbc" "QMAKE_LIBS_ODBC = -lodbc32" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc
    • cd /d E:\Programme\qt\Tools\5.15.0\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-winx64\include -IC:\Utils\postgresql\pgsql\include -IE:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make

    del main.o
    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.o konnte nicht gefunden werden
    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-winx64\include -IC:\Utils\postgresql\pgsql\include -IE:\Programme\qt\Tools\5.15.0\mingw81_64\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:498: 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



  • @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    Command line: "MYSQL_INCDIR=C:/Program Files/MySQL/MariaDB/include" "MYSQL_LIBDIR=C:/Program Files/MySQL/MariaDB/lib"

    From the picture your posted above, your include dir should be C:/Program Files/MySQL/MariaDB/include/mariadb
    (Or should it be C:/Programme/MySQL/MariaDB/include/mariadb ? I'm not sure with that.)
    Just make sure there is a "mysql.h" in the dir you pass as MYSQL_INCDIR...
    I don't know what your lib dir should be though, but it should have a corresponding .lib file in it.



  • @Bonnie
    yeah this time was better it tried loading mysql but it says no :(

    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MariaDB/include/mariadb" MYSQL_LIBDIR="C:/Program Files/MySQL/MariaDB/lib/mariadb"

    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 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 'E:\Programme\qt\Tools\5.15.0\mingw81_64'.

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    Command line: "MYSQL_INCDIR=C:/Program Files/MySQL/MariaDB/include/mariadb" "MYSQL_LIBDIR=C:/Program Files/MySQL/MariaDB/lib/mariadb"
    Global lib dirs: [C:\openssl\lib C:\Utils\my_sql\mysql-5.7.25-winx64\lib C:\Utils\postgresql\pgsql\lib] [E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc E:/Programme/qt/Tools/Tools/mingw810_64/x86_64-w64-mingw32/lib E:/Programme/qt/Tools/Tools/mingw810_64/lib]
    Global inc dirs: [C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include] [E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include E:/Programme/qt/Tools/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed E:/Programme/qt/Tools/Tools/mingw810_64/x86_64-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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = "-LC:/Program Files/MySQL/MariaDB/lib/mariadb" -llibmariadb" "QMAKE_INCDIR_MYSQL = "C:/Program Files/MySQL/MariaDB/include/mariadb"" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && set MAKEFLAGS=& mingw32-make

    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-winx64\include -IC:\Utils\postgresql\pgsql\include -I"C:\Program Files\MySQL\MariaDB\include\mariadb" -IE:\Programme\qt\Tools\5.15.0\mingw81_64\mkspecs\win32-g++ -o main.o main.cpp
    g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.7.25-winx64\lib -LC:\Utils\postgresql\pgsql\lib -L"C:\Program Files\MySQL\MariaDB\lib\mariadb" -llibmariadb
    E:/Programme/qt/Tools/mingw810_64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibmariadb
    collect2.exe: error: ld returned 1 exit status
    mingw32-make: *** [Makefile:69: mysql.exe] Error 1
    => source failed verification.
    Trying source 6 (type inline) of library mysql ...

    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += mysql" "QMAKE_LIBS_MYSQL = "-LC:/Program Files/MySQL/MariaDB/lib/mariadb" -llibmysql" "QMAKE_INCDIR_MYSQL = "C:/Program Files/MySQL/MariaDB/include/mariadb"" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/mysql
    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\mysql && 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-winx64\include -IC:\Utils\postgresql\pgsql\include -I"C:\Program Files\MySQL\MariaDB\include\mariadb" -IE:\Programme\qt\Tools\5.15.0\mingw81_64\mkspecs\win32-g++ -o main.o main.cpp
    g++ -Wl,-s -Wl,-subsystem,console -mthreads -o mysql.exe main.o -LC:\openssl\lib -LC:\Utils\my_sql\mysql-5.7.25-winx64\lib -LC:\Utils\postgresql\pgsql\lib -L"C:\Program Files\MySQL\MariaDB\lib\mariadb" -llibmysql
    E:/Programme/qt/Tools/mingw810_64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibmysql
    collect2.exe: error: ld returned 1 exit status
    mingw32-make: *** [Makefile:69: mysql.exe] 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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\odbc && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += odbc" "QMAKE_LIBS_ODBC = -lodbc32" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/odbc
    • cd /d E:\Programme\qt\Tools\5.15.0\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-winx64\include -IC:\Utils\postgresql\pgsql\include -IE:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\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 E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && E:\Programme\qt\Tools\5.15.0\mingw81_64\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-winx64\lib C:\Utils\postgresql\pgsql\lib" "INCLUDEPATH += C:\openssl\include C:\Utils\my_sql\mysql-5.7.25-winx64\include C:\Utils\postgresql\pgsql\include" "QMAKE_USE += tds" "QMAKE_LIBS_TDS = -lNTWDBLIB" E:/Programme/qt/Tools/5.15.0/Src/qtbase/src/plugins/sqldrivers/config.tests/tds
    • cd /d E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds && set MAKEFLAGS=& mingw32-make clean && set MAKEFLAGS=& mingw32-make

    del main.o
    E:\Programme\qt\Tools\5.15.0\Src\qtbase\src\plugins\sqldrivers\config.tests\tds\main.o konnte nicht gefunden werden
    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-winx64\include -IC:\Utils\postgresql\pgsql\include -IE:\Programme\qt\Tools\5.15.0\mingw81_64\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:498: 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



  • @JonnyQB said in QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7 I need QMYSQL:

    MYSQL_LIBDIR=C:/Program Files/MySQL/MariaDB/lib/mariadb

    Are you sure this folder exists?
    If yes what's in it?





  • @JonnyQB
    Your screenshot shows the word Programme. The output shows MYSQL_LIBDIR=C:/Program Files/MySQL/MariaDB/lib/mariadb. Are these the same paths, through some sort of Windows translation (I don't know)?



  • @JonnyQB
    Those don't look like Windows binaries, where do you get them?
    You cannot use linux binaries such as those for centos/debian/ubuntu.....



  • @Bonnie
    from the mariadb website i just klicked on win 64 c++ connector



  • @JonnyQB
    Which link?
    I've tried "mariadb-connector-c-3.1.9-win64.msi"
    This will install .lib and .dll, not .a and .so.
    If you have also installed the win 64 msi, you may check if the path "C:\Program Files\MariaDB\MariaDB Connector C 64-bit" exists.



  • @Bonnie
    now it worked wtf but thank you all guys i only need to build it now thanks :)


Log in to reply