Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMYSQL driver not loaded
Forum Updated to NodeBB v4.3 + New Features

QMYSQL driver not loaded

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 624 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sakasushi
    wrote on last edited by
    #1

    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

    KroMignonK 1 Reply Last reply
    0
    • S Sakasushi

      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

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by KroMignon
      #2

      @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:

      • what OS you are targetting
      • what Qt kit you are using to build your project (https://doc.qt.io/qtcreator/creator-targets.html)

      Because of Oracle/MySQL licence changes, in newest Qt-Kit, mysql plugin is no more build, but you can build it yourself from sources ==> https://doc.qt.io/qt-5/sql-driver.html#qmysql-for-mysql-or-mariadb-5-and-higher

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      S 1 Reply Last reply
      1
      • KroMignonK KroMignon

        @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:

        • what OS you are targetting
        • what Qt kit you are using to build your project (https://doc.qt.io/qtcreator/creator-targets.html)

        Because of Oracle/MySQL licence changes, in newest Qt-Kit, mysql plugin is no more build, but you can build it yourself from sources ==> https://doc.qt.io/qt-5/sql-driver.html#qmysql-for-mysql-or-mariadb-5-and-higher

        S Offline
        S Offline
        Sakasushi
        wrote on last edited by
        #3

        @KroMignon said in QMYSQL driver not loaded:

        what OS you are targetting
        what Qt kit you are using to build your project (https://doc.qt.io/qtcreator/creator-targets.html)

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sakasushi
          wrote on last edited by
          #4

          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("http://192.168.1.183/phpmyadmin/"); // @ip serveur MySQL
              db.setDatabaseName("chronotrail"); // Nom de la base
              db.setUserName("root"); // Nom utilisateur
              db.setPassword("1234"); // Mot de passe
              db.setPort(3306);
              db.open();
              if (db.open())
              {
                 qDebug() << "Connection BDD OK";
              }
              else
              {
                 qDebug() <<"Erreur de connexion à la BDD";
              }
              FenetreInscription *fenetrePourInscription = new FenetreInscription;
              fenetrePourInscription->show();
          
              return app.exec();
          }```
          
          the ip of the wampserver is 192.168.1.183 and it is in sql on a phpmyadmin
          JonBJ KroMignonK 2 Replies Last reply
          0
          • S Sakasushi

            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("http://192.168.1.183/phpmyadmin/"); // @ip serveur MySQL
                db.setDatabaseName("chronotrail"); // Nom de la base
                db.setUserName("root"); // Nom utilisateur
                db.setPassword("1234"); // Mot de passe
                db.setPort(3306);
                db.open();
                if (db.open())
                {
                   qDebug() << "Connection BDD OK";
                }
                else
                {
                   qDebug() <<"Erreur de connexion à la BDD";
                }
                FenetreInscription *fenetrePourInscription = new FenetreInscription;
                fenetrePourInscription->show();
            
                return app.exec();
            }```
            
            the ip of the wampserver is 192.168.1.183 and it is in sql on a phpmyadmin
            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #5

            @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().

            1 Reply Last reply
            2
            • S Sakasushi

              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("http://192.168.1.183/phpmyadmin/"); // @ip serveur MySQL
                  db.setDatabaseName("chronotrail"); // Nom de la base
                  db.setUserName("root"); // Nom utilisateur
                  db.setPassword("1234"); // Mot de passe
                  db.setPort(3306);
                  db.open();
                  if (db.open())
                  {
                     qDebug() << "Connection BDD OK";
                  }
                  else
                  {
                     qDebug() <<"Erreur de connexion à la BDD";
                  }
                  FenetreInscription *fenetrePourInscription = new FenetreInscription;
                  fenetrePourInscription->show();
              
                  return app.exec();
              }```
              
              the ip of the wampserver is 192.168.1.183 and it is in sql on a phpmyadmin
              KroMignonK Offline
              KroMignonK Offline
              KroMignon
              wrote on last edited by KroMignon
              #6

              @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.

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              1 Reply Last reply
              2

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved