Important: Please read the Qt Code of Conduct -

[SOLVED] Mysql plugin problem.

  • I always encounter the same problem. I was upgrading Qt to new version and then QMysql plugin didn't work because compatible mysql library version didn't exist on my opensuse 13.2 OS. So I was downloading the Qt source code and I found the mysql driver plugin in source code of qt and I compiled the qmysql plugin into compatible mysql library version. This is frustrating. Now I upgraded Qt into 5.5 but I didn't be successful on recompiling Qmysql plugin. Is there a simple solution or is there any guide for QMysql plugin compiling in Qt 5.5.

   => not found
   => /lib64/ (0x00007fc19c948000)
   => /lib64/ (0x00007fc19c708000)
   => /lib64/ (0x00007fc19c4f0000)
   => not found
   => not found
   => /home/ckurdu/bin/Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/ (0x00007fc19c2b0000)
   => /home/ckurdu/bin/Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/ (0x00007fc19bb68000)
   => /lib64/ (0x00007fc19b948000)
   => /usr/lib64/ (0x00007fc19b640000)
   => /lib64/ (0x00007fc19b338000)
   => /lib64/ (0x00007fc19b120000)
   => /lib64/ (0x00007fc19ad78000)
   => /home/ckurdu/bin/Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/ (0x00007fc19a908000)
   => /home/ckurdu/bin/Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/ (0x00007fc19a558000)
   => /home/ckurdu/bin/Qt/5.5/gcc_64/plugins/sqldrivers/./../../lib/ (0x00007fc198b28000)
   => /lib64/ (0x00007fc198920000)
   => /usr/lib64/ (0x00007fc198718000)
   => /lib64/ (0x00007fc198510000)
   => /usr/lib64/ (0x00007fc198200000)
            /lib64/ (0x00007fc19cda8000)
   => /usr/lib64/ (0x00007fc197f90000)

  • Lifetime Qt Champion


    You might be hitting this bug

    You can try applying this patch

    The guide is in the documentation here

    Hope it helps

  • I have Qt 5.5 on Opensuse Linux 13.2. I did things based on the guide you specified.

    Firstly I downloaded source codes of qt5 like below.

    git clone
    cd qt5
    git checkout 5.5
    perl init-repository

    Then based on guide in path "/virtualbox/temp/qt5/qtbase/src/sql/drivers/mysql>"

    ~/bin/Qt/5.5/gcc_64/bin/qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" qsql_mysql.pri

    and this is the result.

    g++ -c -pipe -I/usr/include/mysql -O2 -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/include -I/home/ckurdu/bin/Qt/5.5/gcc_64/include -I/home/ckurdu/bin/Qt/5.5/gcc_64/include/QtGui -I/home/ckurdu/bin/Qt/5.5/gcc_64/include/QtCore -I.moc -I/usr/include/libdrm -I../../../../mkspecs/linux-g++ -o .obj/qsql_mysql.o qsql_mysql.cpp
    qsql_mysql.cpp:36:40: fatal error: QtSql/private/qsqldriver_p.h: No such file or directory
     #include <QtSql/private/qsqldriver_p.h>
    compilation terminated.
    Makefile:704: recipe for target '.obj/qsql_mysql.o' failed
    make: *** [.obj/qsql_mysql.o] Error 1

    What am I doing wrong? Sorry for my broken English.

  • Sorry for my stupidity. I used the wrong path. It must be "qt5/qtbase/src/plugins/sqldrivers/mysql".

    Thank you.

Log in to reply