Qt World Summit: Register Today!

Need Help Installing MySQL Driver on Windows XP 32-Bit for QT 5

  • I am trying to install the mysql driver for MySQL 5.5 and Qt 5 as per the instructions in the Qt Help - but I am unable to get it to work.

    What I have done:

    1. Installed Visual Studio 10
    2. Installed MySQL 5.5 full install
    3. Install Qt5
    4. Wrote the following code in main.cpp:

    #include <QCoreApplication>
    #include <QtCore>
    #include <QtSql>

    int main(int argc, char *argv[])
    QCoreApplication a(argc, argv);

    qDebug() << QSqlDatabase::drivers();
    return a.exec&#40;&#41;;


    5) added sql to the project file for above main.cpp file:


    Project created by QtCreator 2012-12-21T07:52:30


    QT += core sql

    QT -= gui

    TARGET = DBConsoleApp
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp


    1. Opened windows shell from Qt Start Menu and cd'ed in the plugins directory - i.e.C:\Qt\Qt5.0.0\5.0.0\msvc2010\plugins\sqldrivers
    2. mkdir mysql
    3. cd mysql - so now in C:\Qt\Qt5.0.0\5.0.0\msvc2010\plugins\sqldrivers\mysql directory
    4. typed the following as per help instructions:

    qmake "INCLUDEPATH+=C:/Program Files/MySQL/MySQL 5.5 Server/include" "LIBS+=C:/Program Files/MySQL/MySQL 5.5 Server/lib/libmysql.lib" mysql.pro

    10) Received output from qmake:
    Cannot find file: mysql.pro.

    This is as far as I can get.

    Please assist.


  • Hi Albert,

    I had a similar problem with the Linux QT5 and the psql driver.
    If you get the "Cannot find mysql.pro" you probably won't have the sources installed? You should check that first and once you have localized your mysql.pro just try compiling the plugin with the Creator.

    Good luck


Log in to reply