Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MySQL Deployment fails to load driver.



  • I've been going through a seeming gauntlet to get a simple MySQL connection going with a project I'm working on. I'm new to Qt. This forum has been very helpful getting me this far.

    My current problem is a deployment to Windows that includes a MySQL driver built as a plugin and working (finally) on the development workstation. It connects fine there.

    I used winqtdeploy to create the bundle. I enabled debugging on the station I deployed the bundle to: I get:
    [1776] Cannot load library C:\Program Files\QtDBTest\sqldrivers\qsqlmysql.dll: The specified module could not be found.

    The file is there. It has Read/Execute permissions. Am I missing something here?

    Connection fails due to driver.

    Contents of the directory:

    libmysql.dll
    qsqlite.dll
    qsqlmysql.dll
    qsqlodbc.dll
    sqslsql.dll
    


  • I just tried copying the .dll's from a MySQL C++ 8.0 Connector install into the .exe's folder and it works now. These never get mentioned in Dependency Walker. Confusing process to be sure.


  • Lifetime Qt Champion

    Use Dependency Walker or similar tools to see what dlls qsqlmysql.dll needs on the deployed machine. Setting QT_DEBUG_PLUGINS on the command line and running the program from there can also help.



  • I looked at dependency walker and it seems satisfied for qsqlmysql.dll and all top level dependencies. I had already set the QT_DEBUG_PLUGINS env variable which is how I got the error stating:

    [1776] Cannot load library C:\Program Files\QtDBTest\sqldrivers\qsqlmysql.dll: The specified module could not be found.
    

    That's one of the confusing parts. The file is there. The executable is in C:\Program Files\QtDBTest and the sqldrivers is a subdirectory which is what windeployqt created.

    I've had other people tell me to move the files next to the .exe. That has not worked either. I've had people tell me it needs to be in the path. That didn't work either.

    I've tried more than 1 machine to rule out anything specific with that host.

    I should add that I used the following process listed in this thread to build the plugin using MSVS 2017 Native 64 Prompt.



  • I just tried copying the .dll's from a MySQL C++ 8.0 Connector install into the .exe's folder and it works now. These never get mentioned in Dependency Walker. Confusing process to be sure.


  • Lifetime Qt Champion

    Please take a new try - use the stuff from windeploy but move the libmysql.dll from the sqldrivers subdir directly in the executable folder and try again.


Log in to reply