Important: Please read the Qt Code of Conduct -

Problem Loading QMYSQL driver in my Qt Quick project.

  • Hi everybody,
    I'm trying to connect to a MySQL database so in my main.cpp file I added this code:

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
           qWarning( "Connection FAILED." );;

    When I execute all the project (Qt Quick):

    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QPSQL QPSQL7
    Connection FAILED.

    It seems like Qt knows QMYSQL driver is available but it doesn't load it.

    I find some information in the forum but it doesn't help me,

    Does anyone know how to fix it? I'm using Qt 5.6 in Ubuntu 16.04-

    Thank you very much.

  • Lifetime Qt Champion


    That has nothing to do with QtQuick.

    Did you install MySQL's client libraries ? If so then run ldd on the Qt's MySQL plugin. You'll likely find that the client library used to build Qt is older than the one you have installed on your machine.

Log in to reply