Qt World Summit: Submit your Presentation

Difficulties creating MySQL plugin for Qt

  • Hello, everyone!

    I have been trying to install the MySQL plugin for Qt since yesterday, but I have some difficulties.
    I have download the MySQL Community Installer and installed the MySQL Server 8 and MySQL Connector for C++.

    I have followed this tutorial: https://www.seppemagiels.com/blog/create-mysql-driver-qt5-windows
    but when I run this command :

    C:\WINDOWS\system32>set mysql=C:\\PROGRA~1\\MySQL\\MYSQLS~1.0
    C:\WINDOWS\system32>cd C:\Qtold\Sources\qtbase\src\plugins\sqldrivers\mysql
    C:\Qtold\Sources\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%\\include" "LIBS+=%mysql%\\lib\\libmysql.lib" -o Makefile mysql.pro

    I receive the following error:
    Cannot read C:/Qtold/Sources/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: No such file or directory
    Project ERROR: Library 'mysql' is not defined.

    Can you tell me what I am doing wrong and help me install the plugin please?

    Thank you in advance,

  • Qt Champions 2017

    @Paul-Orasan said in Difficulties creating MySQL plugin for Qt:


    There is bug filed already for this. Can you look at the bug ?

  • @dheerendra sorry, where should I look?

  • Qt Champions 2017

  • @dheerendra I understand but then what am I supposed to do now? I really need to make this plugin work.

  • I have tried following this official guide: http://doc.qt.io/qt-5/sql-driver.html#qmysql

    This is the error I get after calling mingw32-make:
    c:\mingw\include\winuser.h:51:20: fatal error: stdarg.h: No such file or directory
    #include <stdarg.h>
    compilation terminated.
    windres: preprocessing failed.
    Makefile.Release:70: recipe for target '.obj/release/qsqlodbc_resource_res.o' failed
    mingw32-make[2]: *** [.obj/release/qsqlodbc_resource_res.o] Error 1
    mingw32-make[2]: Leaving directory 'C:/Qtold/Sources/qtbase/src/plugins/sqldrivers/odbc'
    Makefile:40: recipe for target 'release-all' failed
    mingw32-make[1]: *** [release-all] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qtold/Sources/qtbase/src/plugins/sqldrivers/odbc'
    Makefile:41: recipe for target 'sub-odbc-make_first' failed
    mingw32-make: *** [sub-odbc-make_first] Error 2
    This is the script I ran:

    C:\Qt\Qt5.12.0\5.12.0\mingw73_64>cd C:\Qtold\Sources\qtbase\src\plugins\sqldrivers
    C:\Qtold\Sources\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR=C:\\PROGRA~1\\MySQL\\MYSQLS~1.0\\include "MYSQL_LIBDIR=C:\\PROGRA~1\\MySQL\\MYSQLS~1.0\\lib"

  • Lifetime Qt Champion


    You didn't follow the guide properly. It says make sub-mysql.

    The way you did it, you are currently trying to build all the plugins which is not what you're after.

Log in to reply