Solved MySQL plugin, mingw64 and Windows 8.1 - QMYSQL driver not loaded
-
Which version did you install exactly ?
-
@SGaist The details from Qt Creator's option menu:
Name: Qt 5.6.0 (mingw64) ABI: x86-windows-msys-pe-64bit Source: C:\msys64\mingw64 mkspec: win32-g++ qmake: C:\msys64\mingw64\bin\qmake.exe Default: debug Version: 5.6.0 QMAKE_SPEC win32-g++ QMAKE_VERSION 3.0 QMAKE_XSPEC win32-g++ QT_HOST_BINS C:\msys64\mingw64\bin QT_HOST_DATA C:\msys64\mingw64\share\qt5 QT_HOST_LIBS C:\msys64\mingw64\lib QT_HOST_PREFIX C:\msys64\mingw64 QT_INSTALL_ARCHDATA C:\msys64\mingw64\share\qt5 QT_INSTALL_BINS C:\msys64\mingw64\bin QT_INSTALL_CONFIGURATION QT_INSTALL_DATA C:\msys64\mingw64\share\qt5 QT_INSTALL_DEMOS C:\msys64\mingw64\share\qt5\examples QT_INSTALL_DOCS C:\msys64\mingw64\share\qt5\doc QT_INSTALL_EXAMPLES C:\msys64\mingw64\share\qt5\examples QT_INSTALL_HEADERS C:\msys64\mingw64\include QT_INSTALL_IMPORTS C:\msys64\mingw64\share\qt5\imports QT_INSTALL_LIBEXECS C:\msys64\mingw64\share\qt5\bin QT_INSTALL_LIBS C:\msys64\mingw64\lib QT_INSTALL_PLUGINS C:\msys64\mingw64\share\qt5\plugins QT_INSTALL_PREFIX C:\msys64\mingw64 QT_INSTALL_QML C:\msys64\mingw64\share\qt5\qml QT_INSTALL_TESTS C:\msys64\mingw64\share\qt5\tests QT_INSTALL_TRANSLATIONS C:\msys64\mingw64\share\qt5\translations QT_SYSROOT QT_VERSION 5.6.0
-
I meant where did you get that package ?
-
@SGaist Oh, I used MSYS2 to install it with the command: pacman -Sy mingw-w64-{i686,x86_64}-qt5
Qt Creator is the GPL Windows version from the main site. (this is 32bit which I thought might cause problems but everything else seems to work - I can compile and run 64bit applications that don't use MySQL)
-
For Qt Creator, no there's no influence. It only uses Qt, the architecture of it is of no importance for the functionality (unless of course you are building a plugin for it)
Silly question but: do you have a MinGW64 build of MySQL available on your machine ?
-
@SGaist I don't have MySQL database installed on this machine (as I have another machine setup as a server with it)
I have a 64bit version of MySQL Workbench which was installed from the pre-compiled binaries. This contains the 64bit libmysql.dll which I am using.
Somehow I also have a 32bit version of libmysql.dll although I'm not quite sure where this came from. I've been using it for some time as it works when I compile a 32bit version of my application.
-
Then I wonder if the 32bit version of libmysql is found before the 64bit version.
-
@SGaist I don't think so. When I remove the 32bit libmysql.dll file the 32bit version of my app stops working but the 64bit version still doesn't work.
And when:
LoadLibraryExA("libmysql.dll", NULL, NULL);
is called, it successfully loads the library on both the 32bit and 64bit versions of my app. -
This is the dependences from qsqlmysql.dll (http://imgur.com/MUMHGfN)
Just noticed that it seems a bit odd that libmariadb.dll is needed but libmysql.dll isn't?
-
And that was the problem. I added libmariadb.dll to the same folder as the executable (same place as libmysql.dll) and now it all works!
Why I need a MariaDB library to connect to a MySQL database is still a mystery to me though... In fact libmysql.dll isn't even used - I just removed it and it still works.
Thanks for the help anyway! (if I can work out how, I'll mark this thread as solved)
-
MariaDB is a drop-in replacement for MySQL and AFAIK, you should be able to connect to MySQL servers through the MariaDB client libraries.