Unable to connect to MySQL, driver not loaded
-
Thank you for reaching out!
This is the problem. Everyone points to the documentation without any explanation and nowhere there is a comprehensive guide. I have not had the experience in drivers configuration and database management, only learning.
Your link provides instruction to Compile only a specific sql driver, but the paths to the directories in the code sample do not overlap with my local paths in no way. There are simply no such directories.
For instance:
C:\Qt\6.0.0\mingw81_64\bin\qt-cmake -G Ninja C:\Qt\6.0.0\Src\qtbase\src\plugins\sqldrivers -DMySQL_INCLUDE_DIR="C:\mysql-8.0.22-winx64\include" -DMySQL_LIBRARY="C:\mysql-8.0.22-winx64\lib\libmysql.lib" -DCMAKE_INSTALL_PREFIX="C:\Qt\6.0.0\mingw81_64"My Qt directory does not have mingw81_64 as well as bin in any subfolders of QT.
please refer to the screenshot belowI have tried all the possible directory combinations but it is kinda hard when you don't know what you are doing.
-
Again - when you want to compile something you need sources (at least it's the case for me, don't know if someone else can compile code without sources though). So you want to compile the Qt mysql driver you need theses sources. They're provided by your Qt online installer.
-
That would be a great starting point! But where and what should I be looking for? I have installed Qt via $ pip install PyQt6
@DanilZ
And I believe that is the problem/not sufficient.If you have to build drivers you are going to have to do C++ compilation on source code. I imagine PyQt installation does not provide the sources. You need to get the sources from a Qt installation download.
-
Or use another database like postgresql and blame mysql licensing. :)
-
Postgres looks like a good choice since among my available drivers I have QPSQL. But when changing the .addDatabase('QPSQL') I again get the same error:
I hope this one would be easier to mitigate?
-
Hi,
Did you install the Postgres application ?