Important: Please read the Qt Code of Conduct -

MySQL driver not loaded - Debian Jessie 32-bit

  • Hello.

    I have apps which works correctly on WIN 7. I tried to run on Debian Jessie 32-bit and i have output:

    ("/home/rafal/Qt/5.5/gcc/plugins", "/home/rafal/Dokumenty/QT_Workspace/Projekty/Furniture_APPS")
    QSqlError("", "Driver not loaded", "Driver not loaded")
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7

    I run ldd in path /home/rafal/Qt/5.5/gcc/plugins: (0xb770c000) => not found
    [link text](link url) => /lib/i386-linux-gnu/ (0xb7389000) => /lib/i386-linux-gnu/i686/cmov/ (0xb7357000) => /lib/i386-linux-gnu/i686/cmov/ (0xb733e000) => not found => not found => /home/rafal/Qt/5.5/gcc/plugins/sqldrivers/./../../lib/ (0xb70b3000) => /home/rafal/Qt/5.5/gcc/plugins/sqldrivers/./../../lib/ (0xb6b69000) => /lib/i386-linux-gnu/i686/cmov/ (0xb6b4d000) => /usr/lib/i386-linux-gnu/ (0xb6a5b000) => /lib/i386-linux-gnu/i686/cmov/ (0xb6a15000) => /lib/i386-linux-gnu/ (0xb69f8000) => /lib/i386-linux-gnu/i686/cmov/ (0xb684d000) => /lib/i386-linux-gnu/i686/cmov/ (0xb6848000) => /home/rafal/Qt/5.5/gcc/plugins/sqldrivers/./../../lib/ (0xb65cf000) => /home/rafal/Qt/5.5/gcc/plugins/sqldrivers/./../../lib/ (0xb6427000) => /home/rafal/Qt/5.5/gcc/plugins/sqldrivers/./../../lib/ (0xb4bfc000) => /usr/lib/i386-linux-gnu/ (0xb4bf8000) => /lib/i386-linux-gnu/i686/cmov/ (0xb4bef000) => /lib/i386-linux-gnu/ (0xb4ac7000)
    /lib/ (0xb770f000) => /lib/i386-linux-gnu/ (0xb4a56000)

    After that i tried this commands:

    ln -s
    ln -s
    ln -s

    ldd changed but still does not work MYSQL driver.

    Can someone help me?

  • How to Build the QMYSQL Plugin on Unix and Mac OS X

    You need the MySQL header files and as well as the shared library Depending on your Linux distribution you may need to install a package which is usually called "mysql-devel".

    Tell qmake where to find the MySQL header files and shared libraries (here it is assumed that MySQL is installed in /usr/local) and run make:

    cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql
    qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r"
    After installing Qt, you also need to install the plugin in the standard location:

    cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql
    make install

  • Lifetime Qt Champion


    Don't do the linking yourself, you need to install the MySQL and OpenSSL dev packages, they will provide what you need.

    Once that done, check with ldd again to verify that all libraries are found correctly

  • I installed QT and MySQL. I'm confused about file location:

    First one:
    Second one:**

    Location of Qt:
    /home/rafal/Qt/5.5/gcc/plugins - i cant find here


    1. cd $QTDIR/qtbase/src/plugins/sqldrivers/mysql - is it First one?
    2. qmake "INCLUDEPATH+=/usr/local/include" "LIBS+=-L/usr/local/lib -lmysqlclient_r" - Which location here?

  • Lifetime Qt Champion

    First location is the Qt MySQL plugin
    Second location is the MySQL header file

    Looks like you're trying to mix a system installed Qt with your own install of Qt. which one are you currently using ?