Solved QT5.12.3 mysql
-
Re: [Creating MySQL plugin for QtCreator](mingw73_64 without full Qt recompile.)
I am trying to connect to a mariadb db I have read several pages of how to compile the driver."D:\Qt\5.12.3\Src\qtbase\src\plugins\sqldrivers\mysql>set mysql=D:\MariaDB
D:\Qt\5.12.3\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmariadb.lib" -o Makefile mysql.pro
Cannot read D:/Qt/5.12.3/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: No such file or directory
Project ERROR: Library 'mysql' is not defined.D:\Qt\5.12.3\Src\qtbase\src\plugins\sqldrivers\mysql>reimp
'reimp' is not recognized as an internal or external command,
operable program or batch file.D:\Qt\5.12.3\Src\qtbase\src\plugins\sqldrivers\mysql>reimp
'reimp' is not recognized as an internal or external command,
operable program or batch file."I have read the page here https://forum.qt.io/topic/40672/how-to-create-the-plugin-of-mysql-for-qt
but cannot get the "reimp" to work the file is not recognized.
I am just starting to learn QT and reading through a book "Hands on gui programming with C++ and QT5" but I cannot get the
mysql to connect. So something that I thought would take a few minutes to do has consumed 5 hours of my day and I have gotten nowhere.
I have the read several pages but always get stuck because the directions either do not work or are too old to follow along with.Are there new directions available that make sense?
-
@iceruam said in QT5.12.3 mysql:
Cannot read D:/Qt/5.12.3/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: No such file or directory
Project ERROR: Library 'mysql' is not defined.This is the actual issue. Does D:/Qt/5.12.3/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri exist?
Also make sure you call the correct qmake (use absolute path). If you have more than one Qt version installed you don't really know which qmake will be used. -
Thanks jsulm:
I did find the qtsqldrivers-config.pri in a different directory, I moved it.
but still got :Project ERROR: Library 'mysql' is not defined.
I found this page: [https://lists.qt-project.org/pipermail/development/2017-May/029889.html](link url)
and removed the QMAKE_USE += mysql line
it compiled and ended up with the 4 files
libqsqlmysql.a
libqsqlmysqld.a
qsqlmysql.dll
qsqlmysqld.dl
Copied them to the qtcreator plugins\sqldrivers directory
I am still stuck atQSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 -
I now have it working, I suppose, I was using qt 5.12.3 MinGW 64-Bit
I decided to try the 32-bit, it connected. I am ready to scream.
Thanks for all of your help. I am not sure what I did that I did not need to do or what I messed up now :(
I will use the 32 bit as long as it is working. Maybe I will try to correct the 64-bit issue if I deem necessary down the road.Where should I start to look to try to resolve this?
THANKS for your help and suggestions.
-
This post is deleted! -
Hi All,
I wish to inform you that I have been battling with issue of building QMySQL driver for Qt 5.13.0 for quite sometime, I am new to using Qt technology though.
I read you said you found qtsqldrivers-config.pri some where. Can you let me know where you got it?
You also added that you deleted QMAKE_USE += mysql from mysql.pro file which I did. When I tried to build the driver using qmake: "INCLUDEPATH+=C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" "LIBS+=C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\opt" command, qmake could not see mysql driver source. However, qtsqldrivers-config.pri was generated in the cause of that. Hence, I deleted all other generated files and attempted to use the generated qtsqldrivers-config.pri to no avail. And, this has been the issue I have been having ever since I started attempt to build the driver, qmake will not see MySQL source to build. I always get the following result:
Running configuration tests...
Checking for DB2 (IBM)... no
Checking for InterBase... no
Checking for MySQL... no
Checking for OCI (Oracle)... no
Checking for ODBC... yes
Checking for PostgreSQL... no
Checking for SQLite (version 2)... no
Checking for TDS (Sybase)... no
Done running configuration tests.Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... yes
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... noQt is now configured for building. Just run 'mingw32-make'.
Once everything is built, you must run 'mingw32-make install'.
Qt will be installed into 'C:\Qt\Qt5.13.0\5.13.0\mingw73_32'.Where did I get it wrong?
Cheers,
Heman.