qt and mysql connection QMYSQL driver is not even in the list of available drivers
-
Hello all. I am back with an old topic about QMYSQL driver. I have an error driver doesn't load. But here is the list of available drivers from debug console.
QSqlDatabase: QMYSQL driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7
That is strange for me because in every forum topic and tutorials i have seeen it was present in the list. I tryed different tutorials even copying mysqllib.dll into windows folder but no result. Last I have tryed the steps from documentation.
in sqldrivers/mysql folder:
qmake -- MYSQL_INCDIR=C:/OSPanel/modules/database/MySQL-5.7-x64/include "MYSQL_LIBDIR=C:\OSPanel\modules\database\MySQL-5.7-x64/lib/"
and then in sqldrivers folder
mingw32-make sub-mysql
there I got an error no rules to make sub mysql. Also I have tryed to enable mysql using configure it gives an error that mysql enabled but library failed. What can I do about it? And sould be it matter if QMYSQL driver is epsont in driver list? I am using Win 10 x64. qt 5.12.0 and mingw730 x64. MySQL version 5.7 x64
-
As always (and mentioned many times here).
Remove your qmake.cache and other stuff from sqldrivers subdir (and mysql subdir) and follow the instructions: https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-unix-and-macoscd %QTDIR%\qtbase\src\plugins\sqldrivers qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/MYSQL/MySQL Server <version>/lib/opt" nmake sub-mysql
-
@Christian-Ehrlicher what do you mean by removing other stuffs from sqldrivers subdirectories ?.. do you mean to delete everything so this folder gets empty?
-
@U7Development said in qt and mysql connection QMYSQL driver is not even in the list of available drivers:
what do you mean by removing other stuffs from sqldrivers subdirectories ?.. do you mean to delete everything so this folder gets empty?
He meant: Delete all the files that were generated by a previous configuration/build. the
sqldrivers
folder (and all its subfolders) should only contain the files from the source code package.there I got an error no rules to make sub mysql.
Pay attention to the output when you run
qmake
. If it can't find MySQL, it will say so there. -
@U7Development As said at least three times to you already: follow the instructions!