QT 5.5, windows 7, and MySQL
 
 
I have done QT 5.5 and MySQL connection.
Running official QT example SQL Browser works fine.
I share my experience here. 
 
 
(1) MySQL's sql driver can be found under QT directory
Path:
C:\Qt\Qt5.5.1\5.5\mingw492_32\plugins\sqldrivers
File names are: qsqlmysql.dll及 qsqlmysqld.dll
(We do not need to compile SQL driver) 
 
(2) We need to add SQL library support in *.pro file as below.
QT += sql

 

 
(3) The point is under Windows 7 (Win7), we need to put libmysql.dll to the folder of *.exe file. Here is my example. The *.exe file is sqlbrowser.exe.
2016-03-14 09_00_41-debug.png
 
How can we get libmysql.dll?
Please go to MySQL website, and download "Windows (x86, 32-bit), ZIP Archive".
Unzip the zip file and you can get it in mysql-5.7.11-win32\lib\libmysql.dll
Copy libmysql.dll file to the same folder with *.exe.
 
 
Let me summary my article. You just need to do the step (3). (The part in blue)
 
Reference:
https://forum.qt.io/topic/36371/solved-qt5-2-can-find-the-mysql-driver-but-can-not-load-it/4
 
 
 
創作者介紹
創作者 mybeauty 的頭像
mybeauty

只是記事本

mybeauty 發表在 痞客邦 留言(0) 人氣()