QSqlDatabase: QMYSQL driver not loaded
-
Hi,
If you are running from the command line, yes.
Otherwise, you can do that in your Python script with os module before doing anything Qt. Or if you are using an IDE, it should provide a mean to change the environment variables.From experience, you will likely have a message stating that the dependencies of the MySQL plugin cannot be found.
-
I managed to activate the more detailed messages and the result was
qt.core.plugin.factoryloader: Got keys from plugin meta data QList("QPSQL")
qt.core.plugin.factoryloader: checking directory path "C:/Users/thiag/AppData/Local/Programs/Python/Python313/sqldrivers" ...
qt.core.library: "C:/Users/thiag/AppData/Local/Programs/Python/Python313/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll" cannot load: Cannot load library C:\Users\thiag\AppData\Local\Programs\Python\Python313\Lib\site-packages\PyQt6\Qt6\plugins\sqldrivers\qsqlmysql.dll: Não foi possível encontrar o procedimento especificado.
qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "C:/Users/thiag/AppData/Local/Programs/Python/Python313/Lib/site-packages/PyQt6/Qt6/plugins/sqldrivers/qsqlmysql.dll" : "Cannot load library C:\Users\thiag\AppData\Local\Programs\Python\Python313\Lib\site-packages\PyQt6\Qt6\plugins\sqldrivers\qsqlmysql.dll: Não foi possível encontrar o procedimento especificado." -
I did not realize...
You might be mixing and matching Qt versions and compilers which is a no go.
Did you check which version of Qt is PyQt6 using ?
Did you verify that you are using the same compiler to build the plug-in that was used for PyQt6 ? -
Hello again.
I managed to compile the plugin correctly using msvc using version 6.7.3 but it returned the error
Cannot mix incompatible Qt library (6.7.3) with this library (6.8.1)
So I tried to do the same process in version 6.8.1, but when running the command
call C:\Qt\6.8.1\msvc2022_64\bin\qt-cmake.bat -G "Ninja" . -DMySQL_INLCUDEDIR="C:\Program Files\MySQL\MySQL Server 8.0\include" -DMySQL_LIBRARY="C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.8 .1\msvc2022_64"
I get the error
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found
Is this a problem with version? I used the same method that had worked in version 6.7.3. If it's a version issue, will I have to wait for a new version to be released by PyQt6?
-
@ThiagoSys said in QSqlDatabase: QMYSQL driver not loaded:
I get the error
I don't see any error here, just information on what features are found/not found.
-
-
You said in one of the posts linked above to Update to 6.8.2 / 6.9.0
But when I run my code with plugin version 6.7.3 I got the following error
Cannot mix incompatible Qt library (6.7.3) with this library (6.8.1)If I install version 6.8.2 wouldn't this incompatibility happen in the same way?
-
I also wrote that you can apply the patch...
-
@Christian-Ehrlicher Can you provide me with an explanation on how to apply the patch?
-
From the looks of it, you can also disable the sbom. See this comment on the bug report.
As for patching, do you know how to apply a diff ?
If not, one possible solution is to just copy the two files from 6.8.2 into your current sources but I would encourage you to learn how to apply a patch. -
@SGaist
I tried to learn how to apply a patch but it's complicated, I'm Brazilian and I can't find much about it in Portuguese.
About disabling sbom I tried adding the commands -DQT_GENERATE_SBOM=OFF and -no-sbom but it didn't change. I'm thinking about giving up and doing it the traditional way -
@ThiagoSys What about this suggestion from @SGaist : "one possible solution is to just copy the two files from 6.8.2 into your current sources"?
And applying patches isn't isn't complicated.