MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work
-
@jsulm said in MySql Driver not loaded , Note: i tried all the existed forums problems and didn't work:
I'm asking because you used qmake without absolute path.
And because the plugin name is wrong - the '4' looks suspicious.
-
@MostafaEzzat It still looks like you DO not follow the documentation (https://doc.qt.io/qt-5/sql-driver.html#building-the-drivers): after building you need to do "make install", that will copy the DLLs to your Qt installation.
Also, are you sure you used the correct qmake to build the plug-ins? I'm asking because you used qmake without absolute path.i did use
mingw32-make sub-mysql then mingw32-make install
but i'm not sure i use the right path because i was running this software on linux before
but this my .pro file
should i change the path from .pro file or options#------------------------------------------------- # # Project created by QtCreator 2018-12-24T22:54:39 # #------------------------------------------------- # QT += core gui sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets designer TARGET = Hospital-ClinicSoftware TEMPLATE += app lib libs # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 designer plugins plugin SOURCES += \ main.cpp \ mainwindow.cpp \ mainprocess.cpp \ mysqldatabase.cpp \ showingdata.cpp \ delgate.cpp \ profile3.cpp \ profile.cpp \ multipagewidget.cpp \ multipagewidgetplugin.cpp \ multipagewidgetcontainerextension.cpp \ multipagewidgetextensionfactory.cpp \ mysqldatabase.cpp HEADERS += \ mainwindow.h \ mainprocess.h \ showingdata.h \ delgate.h \ profile3.h \ profile.h \ multipagewidget.h \ multipagewidgetplugin.h \ multipagewidgetcontainerextension.h \ multipagewidgetextensionfactory.h \ mysqldatabase.h FORMS += \ mainwindow.ui \ mainprocess.ui \ showingdata.ui \ profile3.ui \ profile.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path += /opt/$${TARGET}/bin $$[QT_INSTALL_PLUGINS]/designer !isEmpty(target.path): INSTALLS += target
-
i did use
mingw32-make sub-mysql then mingw32-make install
but i'm not sure i use the right path because i was running this software on linux before
but this my .pro file
should i change the path from .pro file or options#------------------------------------------------- # # Project created by QtCreator 2018-12-24T22:54:39 # #------------------------------------------------- # QT += core gui sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets designer TARGET = Hospital-ClinicSoftware TEMPLATE += app lib libs # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 CONFIG += c++11 designer plugins plugin SOURCES += \ main.cpp \ mainwindow.cpp \ mainprocess.cpp \ mysqldatabase.cpp \ showingdata.cpp \ delgate.cpp \ profile3.cpp \ profile.cpp \ multipagewidget.cpp \ multipagewidgetplugin.cpp \ multipagewidgetcontainerextension.cpp \ multipagewidgetextensionfactory.cpp \ mysqldatabase.cpp HEADERS += \ mainwindow.h \ mainprocess.h \ showingdata.h \ delgate.h \ profile3.h \ profile.h \ multipagewidget.h \ multipagewidgetplugin.h \ multipagewidgetcontainerextension.h \ multipagewidgetextensionfactory.h \ mysqldatabase.h FORMS += \ mainwindow.ui \ mainprocess.ui \ showingdata.ui \ profile3.ui \ profile.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path += /opt/$${TARGET}/bin $$[QT_INSTALL_PLUGINS]/designer !isEmpty(target.path): INSTALLS += target
@MostafaEzzat You should call qmake using whole path to make sure you use the one from the Qt version you're building for.
-
@MostafaEzzat You should call qmake using whole path to make sure you use the one from the Qt version you're building for.
such a weird thing , i didn't know that i should copy libmysql.dll to D:\Qt\5.15.1\mingw81_32\plugins\sqldrivers
i only copied to mingw81_32/bin
now it's working
Got keys from plugin meta data ("QPSQL7", "QPSQL") QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/sqldrivers" ... ("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7") loaded library "D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers/qsqlmysql.dll" Donnne Connected
Thank you guys i do love this community
-
such a weird thing , i didn't know that i should copy libmysql.dll to D:\Qt\5.15.1\mingw81_32\plugins\sqldrivers
i only copied to mingw81_32/bin
now it's working
Got keys from plugin meta data ("QPSQL7", "QPSQL") QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/Mostafa/Downloads/HospitalSoftware Last Version/build-Hospital-ClinicSoftware-Desktop_Qt_5_15_1_MinGW_32_bit-Debug/debug/sqldrivers" ... ("QSQLITE", "QMARIADB", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7") loaded library "D:/Qt/5.15.1/mingw81_32/plugins/sqldrivers/qsqlmysql.dll" Donnne Connected
Thank you guys i do love this community
@MostafaEzzat Yes, plug-ins are somewhat special: they are expected to be in a specific location and are loaded at runtime.