Important: Please read the Qt Code of Conduct -

QMYSQL driver not loaded

  • Hello i try to connected my qt to my bdd but it's don't work the error message is :
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7

    i try lot of think but nothing work i use Qt Creator 5.12.10 i needs your help. sorry for my bad english

  • @Sakasushi said in QMYSQL driver not loaded:

    i try lot of think but nothing work i use Qt Creator 5.12.10 i needs your help. sorry for my bad english

    QtCreator is a good IDE, but this is not a relevant information.
    What we need to know is:

    Because of Oracle/MySQL licence changes, in newest Qt-Kit, mysql plugin is no more build, but you can build it yourself from sources ==>

  • @KroMignon said in QMYSQL driver not loaded:

    what OS you are targetting
    what Qt kit you are using to build your project (

    The os I target it's Windows 10 64 bit.
    And the kit named Desktop Qt 5.12.10 MinGW 64-bit.

  • I solved the problem I had with a video but now I have another problem the bbd does not open I do not know why it is hosted on wampserver I send you the code

    #include <QApplication>
    #include <fenetreconfirmation.h>
    #include <fenetreinscription.h>
    #include <sql.h>
    #include <QtSql>
    #include <QSqlDatabase>
    int main(int argc, char *argv[])
        QApplication app(argc, argv);
        QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
        db.setHostName(""); // @ip serveur MySQL
        db.setDatabaseName("chronotrail"); // Nom de la base
        db.setUserName("root"); // Nom utilisateur
        db.setPassword("1234"); // Mot de passe
        if (
           qDebug() << "Connection BDD OK";
           qDebug() <<"Erreur de connexion à la BDD";
        FenetreInscription *fenetrePourInscription = new FenetreInscription;
        return app.exec();
    the ip of the wampserver is and it is in sql on a phpmyadmin

  • @Sakasushi
    You are sure that the host for the MySQL server is phpmyadmin?? Does not sound right to me....

    Obviously, if you get an error you will want to see what's in QSqlDatabase::lastError().

  • @Sakasushi as @JonB already has written, you are mixing up MySQL/MariaDB and phpMyAdmin:

    • MySQL/MariaDB are database engines
    • phpMyAdmin is a database administration tool

    If you want to use QSqlDatabase/QSqlQuery/etc., you have to connect to the db engine.

Log in to reply