Important: Please read the Qt Code of Conduct -

QT and MYSQL on Windows 7 64-Bit

  • Dear readers.

    I have been trying to install MYSQL for over 2 weeks now without any success.
    Hopefully anyone can walk me through it. I will try to give you as much information as possible.

    1. I am using Microsoft Windows 7 Professional 64-Bit version.
    2. I downloaden Qt SDK from (the left one containing Qt 4.7.4, Creator and Qt Quick)
    3. I downloaden MYSQL from and chose the Windows (x86, 32-bit), MSI Installer *

    I tried like (seriously) way over 20 tutorials but none worked out. The one I think was best was the one located at

    Anyways, when I open Qt4.7.3 for Desktop (MinGW) it does NOT recognise the qmake command. I have to use the
    Qt4.7.4 for Desktop (MinGW) program. This one does recognise the qmake command.

    When I follow the tutorial and enter the command:
    qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile

    I reveive this error four times:
    WARNING: (internal):1: Unescaped backslasher are deprecated.

    Anyways, I read on the internet that more people had this error, but when proceeding it didnt matter to them so I
    tried to proceed to the next command which is:

    This gives me a load of text and at the end the following error:
    ! of DOS prompt with errors)!

    It does not make the four file which I need to get.

    So, long story short. HELP ME OUT! lol
    Been on this for way over 2 weeks and I am getting a bit frustrated lol. Hope someone can help me with
    this problem and walk me through this process step by step.

    If talking to me directly on MSN would help the process then no problem, I will post the solution on here
    afterwards to help other people with the same problem out.

    Have a nice (pre) weekend and thanks in forward if you are going to try to help me out ;)

    • I read that 64-bit is currently unsupported so I took the 32-bit MSI installer.

  • Still not found a sollution unfortunately... anyone who knows a possible sollution?

  • Looks like your %mysql% environment variable ist empty. Try to use an absolute path without any variables in it.

  • well, it is still not working correctly.
    When I type in this:

    qmake "INCLUDEPATH+=e:\MYSQLínclude" "LIBS+=e:\MYSQL\lib\libmysql.lib" -o Makefile

    I get 3 errors all saying:

    WARNING: <internal>:1: Unescaped Backslashes are deprecated

    When I type in mingw32-make I get a longgggg list of tekst some stuff like:

    E:\Qt\QtSources\4.7.3\src\plugins\sqldrivers\mysql/../../../sql/drivers/mysql/qsql_mysql,cpp:1365: undefined reference to 'mysql_list_tables@8'

    think it are about 30 errors or something like that.

    All the way down it says:

    mingw32-make: *** [debug] Error 2

  • You should just add


    not the use of forward slashes, they work just fine, qmake will translate that to native backslashes automagically.

    And of course, make sure to us the same bit width for your complete tool chain and set of libraries. You cannot mix 32 and 64 bit libs.

  • Thanks Volker, i will give this a try in the morning. I downloaded the 32-bit version of MySQL and any other thing I downloaded, even though my CPU is a 64-bit one. I read that Qt does not support 64-bit MYSQL yet.

    I will let you know if your sollution worked ;)

  • The 64bit CPUs can exeucte 32 bit code without problems, the operating system usually dont't make trouble either.

    Hm, if you have a 64 bit build of Qt, it should work with mysql too.

  • Ohhh good to know Volker, thanks (again lol)!
    I will re-download everything tomorrow and I will retry everything from scratch to make
    sure I am using all the right stuff, and doing it the right way.

    If by any reason the process would still fail, I will post the error here. If I succeed in installing
    MySQL I will post it here to ;)

  • Well, I did the following guys:

    1. I reinstalled my complete computer (Windows 7 Professional 64-Bit).
    2. I downloaded QtSDK 4.7.4 and installed it at E:\ drive
    3. I downloaded MySQL Server 5.5 and installed it at C:\ drive
    4. Followed the tutorial (in my 1st post) but now again, different errors.

    Since I have been trying to get MySQL working for over a month almost, perhaps
    someone who has experience installing MySQL with Qt on a Windows 7 machine would
    be so kind to help me out using a tool like TeamViewer or something so he can control
    my computer and install it for me ?

    It would only take like 5 minutes in total. I will have all files ready which you need.

    I hope someone would be so kind, since I am really getting frustrated about how hard
    it can be to just get MySQL working in C++ (Qt) lol.

    Best regards

  • Are you using MySQL 32 bit and Qt SDK 32 bit installer? Why don't you give us the full path for you MySQL and Qt SDK installation, maybe I can put the correct command for you to test?

    It looks like it cannot find libmysql.lib. You can test whether you've set the %mysql% variable correctly by using

    @cd %mysql%
    cd lib
    There should be a libmysq.lib in it.

Log in to reply