PDA

View Full Version : QMYSQL Driver not Loaded, there are no driver Available on the QSqlDatabase



aymenbest2
22nd May 2019, 16:37
Hello,

I am currently developing a app that requires interaction with a MySQL database. I already installed MySQL and the x32 C++ Connector. Tried copying its libraries into the project folder, copied the sqldrivers folder from Qt plugins, installed the x64 C++ Connector and copied the libraries again.
Still, I receive the one error to rule them all:

"QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: -------> strange "empty"

Do you have any insight as to why this happens?
I am programming on Windows 10 x64.

Thanks in advance!

anda_skoa
23rd May 2019, 09:13
Maybe the plugin itself can't be found.

To debug further set the QT_DEBUG_PLUGINS environment variable to 1, this should give you some output on what the Qt plugin loader does.
See https://doc.qt.io/qt-5/deployment-plugins.html#debugging-plugins

Or try a different SQL plugin, e.g. for SQLite, just to see if that can be loaded and only the one for MySQL cannot.

Cheers,
_

aymenbest2
27th May 2019, 08:51
Thank you very much, i tried with
int main(int argc, char *argv[])
{
QT_REQUIRE_VERSION(argc,argv,QT_VERSION_STR);
qputenv("QT_DEBUG_PLUGINS", QByteArray("1"));
//QApplication a(argc, argv);
MyApplication a(argc, argv);
....
}
but nothing has changed in the log file? i set QT_DEBUG_PLUGINS = 1 in the Build Environement as well, i had always no changes.
i reconfigured my qt with -plugin-sql-sql, though i know that s not needed. saddly i have always the some Problem. so I reinstall QT 4.8.6 with the default configuration.
Cheers,

aymenbest2
3rd June 2019, 08:59
hello,
Solved by setting QT_PLUGIN_PATH=`pwd`/plugins in the Build environement
cheers,