Important: Please read the Qt Code of Conduct -

How to install MySQL to (or with) Static Version

  • Dear all,

    i know there are some topics about this already, however after two days of trying all i could (mainly I was not aware what Im doing, so maybe i did it wrong), therefore if I can kindly ask you not to link me to other similar topics, please try to give me real example of what to try...

    So at the beginning, I have build stativ version of MinGW 32b, using the script from here and using batch file:

    PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\Qt\windows-build-qt-static.ps1' -QtSrcUrl 'c:\Downloads\From Browser\' -QtStaticDir 'C:\Qt' -MingwDir 'C:\Qt\Tools\mingw730_32' -QtVersion '5.12.3_Static'

    basicaly I followed this guide:
    youtube video

    but now I am finding the MYSQL driver is not available in this new static version:
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3

    I have tried to install new static version modifying the batch file:

    PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\Qt\windows-build-qt-static.ps1' -QtSrcUrl 'c:\Downloads\From Browser\' -QtStaticDir 'C:\Qt' -MingwDir 'C:\Qt\Tools\mingw730_32' -QtVersion '5.12.3_Static_MySQL' -sql-qt-mysql -l mysql -I C:\MySQL\include -L C:\MySQL\lib

    however Im getting error:
    C:\Qt\windows-build-qt-static.ps1 : A parameter cannot be found that matches parameter name 'sql-mysql'.
    (i have tride to modify this command with many variants i couild find online (-sql-qt-mysql, -mysql, ...) but still same error...

    So bck to my question,
    please give me suggestion how to install mysql driver into this stable version, or even when it would mean to install the stable version again with mysql in it, then its fine...

    Thank you for every single suggestion for me to try, cause ive been trying to figure out last 3 days with no luck

  • Lifetime Qt Champion


    What does windows-build-qt-static.ps1 contain ?

  • @SGaist
    its from the link above, contains this,
    i have only modified line 167 and updated sql parametr to "qt-sqlite" as suggested by every topic and it can be seen on video (otherwise if not done, it gets an error at the beginning that sqlite parameter is unknown)

  • Lifetime Qt Champion

    For SQLite you can choose whether you use Qt's bundled version or the one from your system but for the other backends, you have to get the packages for them, hence you only have the -sql-XXX options.

  • @SGaist

    @SGaist said in How to install MySQL to (or with) Static Version:

    you have to get the packages for them, hence you only have the -sql-XXX options.

    Thanks, this was what I was realy expectiong, but I was hoping to guide me up a little, because what I have tried is to follow this guide:
    but durring that I have few errors when opening in Qt. But following this guide i have only one error of Project ERROR: Library 'mysql' is not defined. which according to bug report it should be fixed by commenting line QMAKE_USE += mysql then no error followed but dlls were not created anyway :(

  • Lifetime Qt Champion

    You should also read the MySQL build guide in Qt's documentation. They show the syntax you should use.

Log in to reply