I'm currently working on a Qt5 app, that involves using a mysql database with QMYSQL. It works like a charm during a debug session, but when I compile it in release, I get the error :
Driver not loaded. Driver not loaded.
(Yeah, it actually appears twice).
I already tried including all DLLs, like this :
But this is not working at all, I tried tweaking the qmake options, nothing worked. Is there a trick I'm not aware of ?
Note : The MySQL driver I use is the one I compiled myself.
First of all you should probably not include any "d" ended libraries in your release. "d" means debug and they are used by Qt when you compile in debug and debug builds are linked to those.
Anyway the commentators to your OP are right, the reason why this fails is most likely due to missing MySQL driver in your environment. You either need to include it in your environment or place where your app can automatically load it (like Windows/ directory on Windows or MySQL directory when installed and added to path environment variable) or add it directly to your app's directory.
You can see default locations your app tries to load from by calling QLibrary::libraryPaths
then you can check if the MySQL driver is in any of those locations (it is likely not hence the error). And of course as suggested use Dependency Walker on the qmysql.dll and also your app to see which dependencies failed to load.
Bttom line: You need MySQL driver itself, qmysql.dll depends on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With