How to work : Qt 5.0.0 + MySQL in Windows 8
-
I just want to share something that worked for me after hours and hours trying to get mysql working with Qt (for those having trouble with it). I've started uninstalling every visual studio on my windows 8 machine (I had 2012, 2010 and Windows SDK for Windows 7 and .NET Framework 3.5 SP1) :
- Install Visual C++ Express 2010 and Visual Studio 2010 Express SP1
- Add C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin to the Environment Path
- Install Qt 5.0.0
- Install MySQL 32 bit in C:\MySQL ( be sure of 32 bit version )
- Open Visual Studio Command Prompt, go to C:[QtDIR]\5.0.0\Src\qtbase\src\plugins\sqldrivers\mysql\ and run the commands:
qmake "INCLUDEPATH+=C:\MySQL\include" "LIBS+=C:\MySQL\lib\libmysql.lib" mysql.pro
nmake-
Drivers "must have been created" on C:[QtDIR]\5.0.0\Src\qtbase\plugins\sqldrivers
-
Copy qsqlmysql.dll, qsqlmysqld.dll and libmysql.dll (this last from MySQL/lib dir) to:
C:[QtDIR]\5.0.0\msvc2010\plugins\sqldrivers -
Create project and add the option "QT += sql" to the "pro" file
Thats it, hope it helps someone !