Important: Please read the Qt Code of Conduct -

[SOLVED]QMYSQL driver not loaded ERROR [UBUNTU OS]

  • Hi, folks
    This is my first topic, so i hope i can find my solution here.

    QCoreApplication app(argc, argv);
    QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
    return app.exec();

    When i try to execute this code, i'm gettin this error :

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLİTE QMYSQL .......

    I've read lots of topic about this err. but i can't fix it

    Qt5 mysql dev and lib packs installed even Qt4
    qmake installed

    OS : Ubuntu 15.04.1
    Qt Version : 5.5.0
    MySql Version : 5.6.25-0ubuntu0.15.04.1

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should run ldd on the plugin to see what version of MySQL it's searching.

  • Thank, you for reply.


    gue@gue-linux:~$ ldd /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/ => (0x00007ffe235aa000) => not found => /lib/x86_64-linux-gnu/ (0x00007f0e1f228000) => /lib/x86_64-linux-gnu/ (0x00007f0e1eff0000) => /lib/x86_64-linux-gnu/ (0x00007f0e1edd0000) => not found => not found => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/ (0x00007f0e1eb90000) => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/ (0x00007f0e1e448000) => /lib/x86_64-linux-gnu/ (0x00007f0e1e228000) => /usr/lib/x86_64-linux-gnu/ (0x00007f0e1df18000) => /lib/x86_64-linux-gnu/ (0x00007f0e1dc10000) => /lib/x86_64-linux-gnu/ (0x00007f0e1d9f8000) => /lib/x86_64-linux-gnu/ (0x00007f0e1d628000) => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/ (0x00007f0e1d1b8000) => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/ (0x00007f0e1ce08000) => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/ (0x00007f0e1b3d8000) => /lib/x86_64-linux-gnu/ (0x00007f0e1b1d0000) => /usr/lib/x86_64-linux-gnu/ (0x00007f0e1afc8000) => /lib/x86_64-linux-gnu/ (0x00007f0e1adc0000) => /lib/x86_64-linux-gnu/ (0x00007f0e1aab0000)
    /lib64/ (0x00007f0e1f660000) => /lib/x86_64-linux-gnu/ (0x00007f0e1a840000)

  • OK, i handeled it.
    Thank you so much :)

  • Lifetime Qt Champion

    You're welcome !

    You had the version 18 of the libmysqlclient_r library ?

    Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • Lifetime Qt Champion

    Re-building the plugin to use your currently installed libmysqlclient_r would be the simple and easy path. Just grab the sources and follow the instruction in the database part of Qt's documentation.