QMYSQL DRIVER NOT LOADED
-
Hi All,
I'm trying to make a program that inserts a record into a database. I have lost 2 days for error.I can't connect to the database. i get the following error:
QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL3 QODBC !
I understand I have to buid mysql driver with mysql.h and ilbmysql.dll supply by MYSQLI'm trying with MinGW 7.3.0 32 bit command:
cd C:\Qt\Qt5.14.1\5.14.1\Src\qtbase\src\plugins\sqldrivers
qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib"
this error:
qt1.PNGand other:
cd C:\Qt\Qt5.14.1\5.14.1\Src\qtbase\src\plugins\sqldrivers\mysql
qmake "INCLUDEPATH+=C:\Program Files (x86)\MySQL\MySQL Server 5.5\include" "LIBS+=C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib\libmysql.lib" mysql.prothis error:
I read the Error on github and then I config I delete QMAKE_USE+= mysql in mysql.pro
And ther command:
I can't build file qsqlmysql.dll for driver !! Please help me . If you buid driver for QT 5.14.1 sucsses , can you send me qsqlmysql.dll file ! Thanks best for your time !!!!
-
Hi and welcome to devnet,
You are missing a double quote in the LIBS part of your qmake call.
-
@SGaist said in QMYSQL DRIVER NOT LOADED:
Hi and welcome to devnet,
You are missing a double quote in the LIBS part of your qmake call.Thanks for reply I see you solved this problem in other topic but What i was wrong :((
-
@nguyendinh said in QMYSQL DRIVER NOT LOADED:
What i was wrong
It would be nice if you would put text instead of screen-shots!
What you are doing wrong: you need to put paths containing spaces into "". If you take time to take a closer look at your screen- shot you will see what is wrong: the path to include directory contains spaces, but you did not put it into "", so you have stuff like:-IC:\Program -IFiles
which is of course wrong.
-
@jsulm
Thanks for your support
This my command in QT 5.14.1 mingW 7.3.0 32bit
(I use MYSQL 8.0 64 bit)This my command:
1.cd C:\Qt\Qt5.14.1\5.14.1\Src\qtbase\src\plugins\sqldrivers\mysql
2.qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Server 8.0\include" "LIBS+=C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib" mysql.proAnd then this equal:
-
@nguyendinh said in QMYSQL DRIVER NOT LOADED:
qmake "INCLUDEPATH+=C:\Program Files\MySQL\MySQL Server 8.0\include" "LIBS+=C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib" mysql.pro
qmake INCLUDEPATH+="C:\Program Files\MySQL\MySQL Server 8.0\include" LIBS+="C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib" mysql.pro
-
-
@nguyendinh Your screen-shot still shows your wrong qmake call...
Please do it like I suggested. -
@jsulm sorry I upload wrong images
i copied your command but the equal same as:
1.cd C:\Qt\Qt5.14.1\5.14.1\Src\qtbase\src\plugins\sqldrivers\mysql
2.qmake INCLUDEPATH+="C:\Program Files\MySQL\MySQL Server 8.0\include" LIBS+="C:\Program Files\MySQL\MySQL Server 8.0\lib\libmysql.lib"mysql.pro
3.mingw32-makeThanks best for your time!!!
-
@nguyendinh Please make sure you call qmake/make from a clean state. Means: remove all build artefacts first. Better do out of source build (not from source code directory).
-
@jsulm Thanks every body In this day , I solved the problem. All problem in Makefile
Makefile buid qsqlmysql.dll driver but the linked LIBS or INCLUDEPATH wrong because you using more than 1 qmake command . And this solved you put the true link in Makefile
(Makefile in C:\Qt\Qt5.14.1\5.14.1\Src\qtbase\src\plugins\sqldrivers)
You can fix Makefile in with notepad or etc and then save file
then again in QT command run: mingw32-makeand then qsqlmysql build in C:\Qt\Qt5.14.1\5.14.1\Src\qtbase\src\plugins\sqldrivers\plugins\sqldrivers
then you have to coppy this file for C:\Qt\Qt5.14.1\5.14.1\mingw73_32\plugins\sqldriversNow we can connect to mysql workbench Thanks for all.
-