Qt World Summit: Register Today!

[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 libqsqlmysql.so 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/libqsqlmysql.so
    linux-vdso.so.1 => (0x00007ffe235aa000)
    libmysqlclient_r.so.16 => not found
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0e1f228000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f0e1eff0000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f0e1edd0000)
    libssl.so.10 => not found
    libcrypto.so.10 => not found
    libQt5Sql.so.5 => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/libQt5Sql.so.5 (0x00007f0e1eb90000)
    libQt5Core.so.5 => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/libQt5Core.so.5 (0x00007f0e1e448000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0e1e228000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0e1df18000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0e1dc10000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0e1d9f8000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0e1d628000)
    libicui18n.so.54 => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/libicui18n.so.54 (0x00007f0e1d1b8000)
    libicuuc.so.54 => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/libicuuc.so.54 (0x00007f0e1ce08000)
    libicudata.so.54 => /home/gue/Qt5.5.0/5.5/gcc_64/plugins/sqldrivers/../../lib/libicudata.so.54 (0x00007f0e1b3d8000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0e1b1d0000)
    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f0e1afc8000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0e1adc0000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f0e1aab0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f0e1f660000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (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.