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

MySQL driver on Windows 10



  • First of all I have to mention that I'm not very familiar with Windows, but I have to compile my application on Windows 10. For this I installed MySQL Server 8.0 and Qt 5.13.1. Now I would like to build the mysql driver for Qt.

    Here is my mysql.pro:

    TARGET = qsqlmysql
    
    INCLUDEPATH += "C:/MySQL/MySQL Server 8.0/include"
    LIBS += -L"C:/MySQL/MySQL Server 8.0/lib"
    LIBS += -llibmysql
    
    HEADERS += $$PWD/qsql_mysql_p.h
    SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
    
    QMAKE_USE += mysql
    
    OTHER_FILES += mysql.json
    
    PLUGIN_CLASS_NAME = QMYSQLDriverPlugin
    include(../qsqldriverbase.pri)
    

    When I run qmake I get the following error:

    Project ERROR: Library 'mysql' is not defined.

    Here is the listing of the MySQL direcoty:

    07.09.2019  08:17    <DIR>          .
    07.09.2019  08:17    <DIR>          ..
    26.06.2019  21:19         7’101’952 http_auth_backend.dll
    26.06.2019  21:19         7’071’744 http_auth_realm.dll
    26.06.2019  21:19         7’353’344 http_server.dll
    26.06.2019  21:19            19’968 keepalive.dll
    26.06.2019  21:18         6’479’872 libmysql.dll
    26.06.2019  21:18            29’188 libmysql.lib
    07.09.2019  08:17    <DIR>          mecab
    26.06.2019  21:20         7’892’992 metadata_cache.dll
    26.06.2019  21:18        65’764’822 mysqlclient.lib
    26.06.2019  21:18            44’750 mysqlrouter_http.lib
    26.06.2019  21:19        22’951’984 mysqlrouter_lib.lib
    26.06.2019  21:19            90’624 mysql_protocol.dll
    07.09.2019  08:17    <DIR>          plugin
    26.06.2019  21:20         7’111’680 rest_api.dll
    26.06.2019  21:20         7’121’920 rest_metadata_cache.dll
    26.06.2019  21:20         7’096’320 rest_router.dll
    26.06.2019  21:20         7’140’864 rest_routing.dll
    26.06.2019  21:20         7’461’376 routing.dll
                  16 Datei(en),    160’733’400 Bytes
                   4 Verzeichnis(se), 120’553’926’656 Bytes frei
    
    c:\MySQL\MySQL Server 8.0\lib>
    

    What am I doing wrong here?


  • Lifetime Qt Champion

    Hi,

    Looks like you are not following the Qt SQL drivers documentation, are you ?



  • I tried it, butthe directory C:/MYSQL/MySQL Server <version>/lib/opt does not exist on my Windows installation and I also got the message that %QTDIR%\qtbase\src\plugins\sqldrivers does not exist.

    I have Qt installed here:
    C:\Qt\5.13.1\Src\qtbase\src\plugins\sqldrivers/

    and MySQL here:
    C:\MySQL\MySQL Server 8.0\

    The libmysql.dll is in this directory:
    C:\MySQL\MySQL Server 8.0\lib\

    but there is no:
    C:\MySQL\MySQL Server 8.0\lib\opt

    How would the qmake command line look like with this setup?


  • Lifetime Qt Champion

    You have to update the example given in the documentation to match what you have on your system.


  • Banned

    This post is deleted!

Log in to reply