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) :

    1. Install Visual C++ Express 2010 and Visual Studio 2010 Express SP1
    2. Add C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin to the Environment Path
    3. Install Qt 5.0.0
    4. Install MySQL 32 bit in C:\MySQL ( be sure of 32 bit version )
    5. 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

    1. Drivers "must have been created" on C:[QtDIR]\5.0.0\Src\qtbase\plugins\sqldrivers

    2. Copy qsqlmysql.dll, qsqlmysqld.dll and libmysql.dll (this last from MySQL/lib dir) to:
      C:[QtDIR]\5.0.0\msvc2010\plugins\sqldrivers

    3. Create project and add the option "QT += sql" to the "pro" file

    Thats it, hope it helps someone !



  • do you have a solution for QPSQL, the plugin for PostgreSQL with MinGw compiler?



  • sorry, I´ve been working only on MySQL databases :(


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.