Nominate our 2022 Qt Champions!

Error trying to build Qt SQL drivers

  • This is the error I am getting when trying to build the project for the Qt SQL drivers which are located at C:\Qt\5.12.1\Src\qtbase\src\plugins\sqldrivers\mysql for my environment:

    Cannot read C:/Qt/5.12.1/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: No such file or directory
    Project ERROR: Library 'mysql' is not defined.

    When trying to look for this file in the directory it stated, I found that it doesn't exist:


    The following is the project file for the drivers that I have modified as per instruction to include the INCLUDEPATH, QMAKE_LIBDIR, and LIBS for the MySQL library and include files:

    TARGET = qsqlmysql
    HEADERS += $$PWD/qsql_mysql_p.h
    SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp
    QMAKE_USE += mysql
    OTHER_FILES += mysql.json
    INCLUDEPATH+="C:/PROGRA~1/MySQL/MySQL Server 8.0/include"
    QMAKE_LIBDIR+="C:/PROGRA~1/MySQL/MySQL Server 8.0/lib"
    LIBS += -L"C:/PROGRA~1/MySQL/MySQL Server 8.0/lib" -lmysql

    This is my first time trying to install the Qt SQL drivers, is there a step I missed or screwed up? Can anyone suggest a solution? Thank you in advance for any help.

  • Lifetime Qt Champion


    What exact instructions did you follow ?

    The ones from the documentation ?

Log in to reply