Problem using Mysql driver
I have suffered in 4 days to compile mysql driver . i succeded to do so and try my first sample app that connected correctly to my sql . the next day i wanted to start my related project on mysql (a db manager) i tryed to connect it gave me this message
MYSQL Not Loaded
Available driver SQLITE3 SQLITE ODBC MYSQL
I read the doc and try to solve with no success . then I uninstall completly my Qt, mysql and clean up things like path
I reintall a fresh Qt creator, compile successfully mysql driver. Now this is the message I got
MYSQL Not Loaded
Available driver SQLITE3 SQLITE ODBC
Meaning that mysql drivers is not available any more . the plugin path is correct I have tryed all the attemp in the doc .
please any help would be welcome.
10 replies
as you said I ahev done that now using this
- #include <QtGui/QApplication>
- #include <QtSql>
- int main(int argc, char *argv[])
- {
- return a.exec();
- }
I am getting this error now :
Starting C:\Users\Administrator\Desktop\testger-build-desktop\release\testger.exe…
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlite4.a”
“The file ‘C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlite4.a’ is not a valid Qt plugin.”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlited4.a”
“The file ‘C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlited4.a’ is not a valid Qt plugin.”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysql4.a”
“The file ‘C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysql4.a’ is not a valid Qt plugin.”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysqld4.a”
“The file ‘C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlmysqld4.a’ is not a valid Qt plugin.”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbc4.a”
“The file ‘C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbc4.a’ is not a valid Qt plugin.”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbcd4.a”
“The file ‘C:/Qt/2010.04/qt/plugins/sqldrivers/libqsqlodbcd4.a’ is not a valid Qt plugin.”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlite4.dll”
keys (“QSQLITE”)
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlited4.dll”
“The plugin ‘C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlited4.dll’ uses incompatible Qt library. (Cannot mix debug and release libraries.)”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysql4.dll”
keys (“QMYSQL3”, “QMYSQL”)
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysqld4.dll”
“The plugin ‘C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlmysqld4.dll’ uses incompatible Qt library. (Cannot mix debug and release libraries.)”
not a plugin
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbc4.dll”
keys (“QODBC3”, “QODBC”)
QFactoryLoader::QFactoryLoader() looking at “C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbcd4.dll”
“The plugin ‘C:/Qt/2010.04/qt/plugins/sqldrivers/qsqlodbcd4.dll’ uses incompatible Qt library. (Cannot mix debug and release libraries.)”
not a plugin
QSqlDatabase: MYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL3 QMYSQL QODBC3 QODBC
I too am struggling with the QMYSQL driver issue in building a Windoze application. A first with Qt 4.6 commercial & VS 2008, I follow the plugin instrictions in Assistant, the “driver is not loaded” and the Assistant says it’s usually an issue with the build key. Perhaps someone could suggest a solution to this.
In Linux I recompiled the Qt source with Mysql in the configuration or something like that, and life was good. Do I have to do the same in Winblows too?
This shouldn’t be so difficult. Come on Qt experts, let go of the little details please.
I solved mine on a french source. I used qt creator to built on the commande line. but really this drivers gives some unexpected result from time to time . i succed to built and test it, 2 days later i tried to work on my project it wsa not working any more . my source is Here [giminik.developpez.com]
its in french but to summarize . you need to install mysql with the header files .
assuming u have Mingw install do this on cammand line
- cd C:\MySQL-5.0\lib\opt
- reimp -d libmysql.lib
note sometimes reimp is not in your mingw bin folder, so u need Download [ftp-developpez.com]
or in mingw utilities folder from sourgeforge.net
after u need to do this
- dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a
now u ill need to compile the mysql driver by linking to the lib file that was created in the last process . it is the as in the documentation, but to make u’r life easier i would recomand u to use qt command line tool Mingw . if for some reason u d’ont want there is always a way around. just beaware that compiling with eithercompiler can bring your error. my solution was to clean up everithing and compile again
You must log in to post a reply. Not a member yet? Register here!




