Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QSqlDatabase: QMYSQL driver not loaded qt static build
I'm using qt 5.14.2 and it's a static build version when i building my application using mingw73 dynamic it's working fine but when building it using static compiler it's not working i'm using this library
JonB last edited by
Hi and welcome.
Whenever you get a
QMYSQL driver not loaded ...error at runtime the first thing to do is set environment variable
QT_DEBUG_PLUGINS=1and then run your program. You get diagnostic output. At the end of that is usually the fundamental cause for why it failed, which you have to look at.
Having said that, I believe someone else has asked just this question about static build failing on this just recently.... Ah yes it is on-going at https://forum.qt.io/topic/127424/static-build-qt-qpa-plugin-could-not-find-or-load-the-qt-platform-plugin-windows-in . That is for a different plugin ("windows" rather than "QMYSQL") but it might be relevant. @SGaist is dealing with that, he might notice this post and comment as to whether your situation is related to that.....
Hi and welcome to devnet,
You can't mix dynamic and static plugins.
You have to build it along your static Qt version.
i didn't mix dynamic with static
i mean whn i build my project in dynamic every thing working
but when i try to build it with static version qmysql not working
How did you build your static Qt ?
mingw32 cmd then cd src path
configure -static -debug-and-release -platform win32-g++ -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-angle -sql-sqlite -openssl -I «c:\Qt\Tools\OpenSSL\Win_x86\include» -L «c:\Qt\Tools\OpenSSL\Win_x86» -opensource -confirm-license -make libs -make tools -nomake examples -nomake tests -prefix c:\Qt\5.14.2\mingw73_32_static
I do not see anything in that configure line that points to the MySQL connector libraires to allow the plugin to be built.
fadu last edited by fadu
i'm new in qt how to add it
I only add this to the .pro file
LIBS += -L'C:/MySQL/lib/' -llibmysql
LIBS += -L'C:/MySQL/lib/' -lmysqlclient
#LIBS += -L'C:/mysql-8.0.25-winx64/lib/' -lmysqlclient
INCLUDEPATH += 'C:/MySQL/include'
DEPENDPATH += 'C:/MySQL/include'
@SGaist also tried this
cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir
-qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-psql -qt-sql-mysql -no-openssl
-L C:\MySQL\include\lib -qt-sql-psql -qt-sql-mysql -l mysqlclient -I C:\MySQL\include `
-make libs -nomake tools -nomake examples -nomake tests"
XxTsxX Banned last edited by
This post is deleted!