The best way to combine MinGW and MYSQL?


  • Moderators

    32 bit compilations are not supported everywhere anymore.

    After changing my desktop and the requirement to install everything fresh I have encountered yet another MYSQL driver problem with MinGW on win10 64 bit.

    I am still using Qt 5.4, but I can certainly change to a newer version. However, it does not solve my MYSQL problem. Since still only MinGW 32 bit compiler is used for prebuilds, it will not change anything.

    I have basically an application which is using MYSQL and it was working with Qt 5.4.2 and MYSQL. The new installers of MYSQL are always installing a 64 bit version. When I am using the libraries for bridging from QMYSQL to MYSQL, Qt returns an error that MYSQL is not installed. It does not really surprise me since I have a mix of 32 and 64 bit versions in use.

    I have tried to find a suitable 32 bit MYSQL driver set(up) without success.

    Since I have compiled Qt 5.9.x already with MinGW 64bit compiler, I started to add also the QMYSQL driver compilation with 64 bit MinGW, but failed.

    Did someone manage to find a solution path through the jungle of traps?


  • Moderators

    After putting the issue aside for a couple of month I saw lately Qt5.12 will be available with MinGW 64 bit pre-built. This gave the impulse to take another look.

    Basically I got confused with the different bit versions and also which dlls to use. When I had tried to step back and continue with a more homogenous setup, I stumbled over the next problem e.g. compilation of MYSQL option for Qt with MinGW 64 bit compiler.

    Finally with the help of Qt5.12 beta pre-built and a structured approach I have succeeded in finding the proper MySQL lib/dll.

    With the current online installer of MySQL this is required:
    0_1540920609569_330c1a94-139b-45bd-8a47-cc92b9beb09c-image.png

    There one finds libmysql.dll and libmysql.lib which are required for use with 64 bit MinGW compiler. The important part is x64 for the 64 bit version.
    When looking for the 32 bit version the important indication is x86. This may be used with MinGW 32 bit compilers.

    The other tools installed for use with MySQL and their bit versions are irrelevant. A small test program based on the appropriate Qt kits can connect as 32 bit and 64 bit MinGW compilation to the same DB.

    Unfortunately has the reinstalled mysql on my machine a couple of different libmysql.dll and libmysql.lib, possibly they may work as well, but apparently I had messed up my installation with 32/64 bit installation.

    The only issue left is an SSL connection error for an external db, but that is covered in different thread.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.