Qt World Summit: Submit your Presentation

Mysql driver for qt error "Cannot find file: mysql.pro"

  • I have been spending the whole day trying to figure out how to compile the mysql driver for qt so that i can import a database into table view, but nothing that I have found has helped me out. I am currently using qt 5.5 and Mysql server 5.7. My issue is that I get a certain error when running the following command in the qt command prompt:

    set mysql=C:\PROGRA~2\MySQL\MYSQLS~1.7

    cd C:\Qt\5.5\mingw492_32\plugins\sqldrivers

    qmake "INCLUDEPATH+=%mysql%\include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro


    And I get the error "cannot find file: mysql.pro"

    I don't understand. Am I missing the file in the directory? Or have I not installed qt properly?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You're doing that in an already build Qt, that's wrong. You need to first get the sources. You can do that from the Maintenance Tool.

  • @Randomator Sir,
    download the Qt Sources, e.g current the sources available are qt-everywhere-opensource-src-5.5.1, After extracting
    cd C:\qt-everywhere-opensource-src-5.5.1\qtbase\src\plugins\sqldrivers\mysql
    then make sure you call qmake from Qt5.5, for this purpose you can type the complete path of the qmake.
    then use make and make install.
    I hope it will help you.