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
8 Posts 4 Posters 2.7k Views 1 Watching
  • 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.
  • Y Offline
    Y Offline
    Yacinoben
    wrote on last edited by
    #1

    Hello, I would like to connect in a local database, i use MySql/phpMyAdmin with XXAMP in ubuntu, i configure the file my.cnf and add the line bind-adress = 192.168.56.1

    My source :

        m_db.setPort(3306);
        m_db.setHostName("192.168.1.15");
        m_db.setUserName("Test");
        m_db.setPassword("12345");
        m_db.setDatabaseName("Gestion");
       if(!m_db.open())
        {
         qDebug()<<m_db.lastError().text();
         m_db.close();
        }
    

    Output :
    QSqlDatabase: QMYSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7

    Thank

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please take the time to search the forum, this question has been asked many times over the years and recently.

      You likely have more a recent version of the MySQL client libraries that the one used to build the plugin. You can check that by running ldd on the Qt MySQL plugin. If so then install the MySQL client libraries dev package and rebuild the plugin (only the plugin there's no need to build of all Qt).

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • F Offline
        F Offline
        Fuel
        wrote on last edited by
        #3

        For compiling a Plugin Library for your MySql Version, go to "QT_Path/Your_Version/Src/qtbase/src/plugins/sqldrivers/mysql/". In this directory execute qmake and then make.

        1 Reply Last reply
        1
        • Y Offline
          Y Offline
          Yacinoben
          wrote on last edited by
          #4

          Sorry for late reply, I had a problem with Qt.
          I compiled, but I have the same error when I connect

          alt text

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Do you have the MySQL .dlls folder in your PATH ?

            If not then they won't be found when you start your application thus the plugin can't be loaded.

            You can modify the PATH environment variable in the Run part of the Project panel in Qt Creator.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • M Offline
              M Offline
              mateczek
              wrote on last edited by mateczek
              #6
              1. You must download mySqlCConnector
                https://forum.qt.io/topic/75763/cannot-connect-to-mysql-server/9
              1 Reply Last reply
              1
              • Y Offline
                Y Offline
                Yacinoben
                wrote on last edited by Yacinoben
                #7

                It works. I added libmysql.dll "C:\mysql\lib" in the project.
                thanks for the help !! :)

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  You're welcome !

                  Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1

                  • Login

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